Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting a syntax error unexpected T_STRING for namespace line

Well, I keep getting

Parse error: syntax error, unexpected T_STRING in /path/to/index.php on line 2

Googled my arse off and still nuthing, so far the index.php contains:

<?php
namespace Infire; # Line 2
...

I am using PHP 5.1

Any ideas?

like image 285
Daniul Teeiger Avatar asked Sep 29 '12 07:09

Daniul Teeiger


People also ask

What is unexpected T_string?

This type of error (syntax error) usually happens because of a typo in your code, such as a missing apostrophe/quotation mark/a missing or extra space, or code that has been commented out incorrectly.

What is syntax error unexpected?

The JavaScript exceptions "unexpected token" occur when a specific language construct was expected, but something else was provided. This might be a simple typo.

What is syntax error unexpected end of file?

Unexpected End of File errors can occur when a file doesn't have the proper closing tags. Sometimes this error can present itself as the white screen of death, or a 500 error.

What is syntax error in parsing?

For example, a syntax error can be a forgotten quotation mark, a missing semicolon at the end of a line, missing parenthesis, or extra characters. This leads to a parse error, because the code cannot be read and interpreted correctly by the PHP parser.


1 Answers

The PHP namespace is only supported in PHP 5.3+ version

Check this PHP 5.3.0 Release Announcement

like image 114
NullPoiиteя Avatar answered Sep 20 '22 16:09

NullPoiиteя