Parse error: syntax error, unexpected end of file

May 31, 2014 4k views
I get this error when I installed a tracking script: ---------------------------------------------------------------------------------------- ( ! ) Parse error: syntax error, unexpected end of file in /var/www/track.freemerchandiseblog.com/htdocs/202-config/functions.php 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/track.freemerchandiseblog.com/htdocs/202-config/connect.php' ) ../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 rtcamp.com/easyengine Can anyone help me out with what this error is about and how I can fix it? Thanks so much.
4 Answers
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

Mark
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.

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

Have another answer? Share your knowledge.