Parse error: syntax error, unexpected end of file

May 31, 2014 5.8k views
I get this error when I installed a tracking script: ---------------------------------------------------------------------------------------- ( ! ) Parse error: syntax error, unexpected end of file in /var/www/ on line 189 Call Stack # Time Memory Function Location 1 0.0001 126152 {main}( ) ../index.php:0 2 0.0001 126572 require_once( '/var/www/' ) ../index.php:21 ----------------------------------------------------------------------------------------------- I tried installing the same script on my shared hosting at hostgator and it installed perfectly. I am running on Ubuntu 14.04, and LEMP installed with EasyEngine installation script found at Can anyone help me out with what this error is about and how I can fix it? Thanks so much.
4 Answers

This error is because you are using <? instead of <?php tag. Correct the php opening tag and it will work!

If I remember correctly, unexpected End of File in PHP can be caused by a mis-placed semicolon (;).

It's a pain, but check through the code to make sure that every statement is ended correctly, and that all if and while statements are correctly terminated (make sure there isn't a stray closing bracket } that doesn't pair up).

Something like PHPLinter may help with this.
Thanks William,

But this script is straight from the vendor that came in a zip file. I just unziped in the folder and ran the setup process.

I also tried the same script in my shared hosting account with hostgator and it worked pretty well without any kind of errors.

Is there anything else you think that could go wrong?

Thanks once again

Ubuntu 14.04 is running PHP 5.5. Perhaps the script isn't compatible? Are there any listed system requirements for the software? If you need an older version of PHP, you can try Ubuntu 12.04.
Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!