I went through some trouble and spent some time on this issue before finally realizing that it was a super easy fix. To address a much bigger issue, I was moving a Joomla! 1.5.x(I know, old) site from Fedora 7 to Fedora 14. Just to make sure everything goes well with the upgrade I test everything in a stage environment.
- Fedora 14 comes with php 5.3.8 by default.
- Moved the site and db over. I start seeing a bunch of “Parse error: syntax error, unexpected $end…” httpd errors for a particular template file.
- Checked the php file in question – no php syntax errors.
- Some HTML in that file. Is the HTML malformed in some way? Nope.
- May be its the PHP version.
- yum downgrade php php-* (To version 5.3.3)
- Bring the latest code from git and test.
- This code works on our dev with php 5.3.3 and does not work on this Fedora 14 instance php 5.3.3.
- So nope. Thats not the issue. Revert the changes made to php.
- I installed php-suhosin for security. Is that causing an issue?
- yum erase php-suhosin
- Doesn’t solve anything. Re-install php-suhosin.
- Is anything being dynamically added to the page from the database on load? Nope.
- Check httpd configs – Not the issue.
- Restarted apache a bunch of times and pulled my hair out.
At last I finally realized it has to be PHP settings – I don’t think anything changed drastically with the way people need to code in php from version 5.3.3 and 5.3.8. So I get the php.ini files from dev server and the Fedora 14 server, strip out all the comments and empty lines and do a side by side diff of the two files.
The culprit: short_open_tag=Off
Apparently this is set to off in the newer versions of php.ini file and for a good reason. These tags are notorious for conflicting with xml tags among other things and code containing short tags is generally considered not portable. Portable being the operating word in my situation since I’m jumping a few OS versions. Change this to “On” and restart httpd and I was good to go. Obviously this old version of Joomla! with a bunch of customizations has a lot of legacy code. I really wish I had started with comparing the php.ini files.