There is just a semilicon ;
missing on the second line:
<?php
namespace MyProject ;
echo '"', __NAMESPACE__, '"'; // outputs "MyProject"
?>
You should also get rid of the spaces and blank lines before your <?php
opening tag.
Question
I am running apache2 on Ubuntu 14.04 LTS with 5.5.9-1ubuntu4.
I was uploading a working code to the server but got "NetworkError: 500 Internal Server Error"
So I started tracking down the problem. I traced it back and found out it seems to be a problem with namespace declaration. In trying to figure it out (simplify things) I created a new file that duplicates the error.
<?php
namespace MyProject ;
echo '"', __NAMESPACE__, '"'; // outputs "MyProject"
?>
When put through a browser it generates the above error.
If I comment out the 2nd line, it runs without error and produces the expected output
""
Any ideas what is happening?
Solution
There is just a semilicon ;
missing on the second line:
<?php
namespace MyProject ;
echo '"', __NAMESPACE__, '"'; // outputs "MyProject"
?>
You should also get rid of the spaces and blank lines before your <?php
opening tag.