I'm not sure if this question belongs here or StackOverflow...

Some time ago I wrote a web app using Zend Framework and since then it ran flawlessly on a standard shared hosting (lampp stack). I bought a VPS and set up a few sites without a problem using NGINX and PHP-FPM. I decided to migrate the mentioned site to the new server - ZF doesn't render layout or any templates. It just prints the layout.phtml file without interpreting the code in it. There aren't any errors in the logs. The version in Zend/Version.php says '1.7.1'.

The first thing that comes to mind is the version of PHP but it is 5.x - the same that was running on the shared hosting. I'm completely clueless here.

Should I upgrade to latest ZF? What would you do to debug it?

link|improve this question
UPDATE: I upgraded ZF to the latest version and nothing's changed. – pinkeen Dec 10 '10 at 16:12
feedback

1 Answer

up vote 0 down vote accepted

Your templates probably use short opening tags <? or <?=$foo versus <?php or <?php echo $foo. This is turned off by default in PHP 5.3 (possibly earlier) so you have enable it in your php.ini file.

link|improve this answer
I haven't touched php code for a long, long time. I've read that short opening tags are evil and I didn't use them anywhere, except for the templates, because the ZF docs said specifically that they can be used in ZF templates... Supposedly ZF parses templates in a different way than ordinary php scripts. Nevertheless, I'll check it out and post the results. – pinkeen Dec 10 '10 at 16:21
Thank you, It works now! But could somebody explain this to me? When I was coding this site, ZF docs explicitly stated that short tags are evil except the templates. What's more, even then, [short openings] wouldn't work by default in normal php scripts (and I didn't use them) but they did work in templates. What's changed? – pinkeen Dec 10 '10 at 16:27
Short opening tags are only evil in the sense that they can be disabled. If you're not in control of your environment then it's a good idea to not use them, but if you are certain you can change the setting then there's no down side. – Martin Fjordvald Dec 10 '10 at 16:30
I agree, it makes perfect sense. I feel so dumb that I forgot about this basic issue and panicked right away. I'm not a newbie but I never managed a production server before (but I have set up various stacks for development a dozen times). – pinkeen Dec 10 '10 at 16:46
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.