Joho the Blog » When php will only read itself
EverydayChaos
Everyday Chaos
Too Big to Know
Too Big to Know
Cluetrain 10th Anniversary edition
Cluetrain 10th Anniversary
Everything Is Miscellaneous
Everything Is Miscellaneous
Small Pieces cover
Small Pieces Loosely Joined
Cluetrain cover
Cluetrain Manifesto
My face
Speaker info
Who am I? (Blog Disclosure Form) Copy this link as RSS address Atom Feed

When php will only read itself

Some little apps I’ve written for myself over the years refused to work on a Mac with Lion that I’ve started using at work. The problem was that any php invoked via Ajax would return only itself — that is, the return value would be the lines of the php script itself. This is not helpful.

I poked around a lot on the Net and couldn’t find anything relevant. The closest was the observation that this can happen if you begin your PHP scripts with just a <? instead of <?php, which seems awfully persnickety. Unfortunately, my scripts didn’t begin with the abbreviated form.

After getting some help by posting at Stackoverflow.com, it seemed that the machines that my scripts have worked on have PHP v.5.3.8, whereas my Lion computer for some reason was at PHP 5.3.1. So, I upgraded the php to 5.4. This page has easy instructions for doing so: http://php-osx.liip.ch. (If you want to know what version of PHP you have, in a terminal window type “php -v”.)

I’m not 100% sure that it was the PHP upgrade that did it and not some random other change or a change in the phase of the moon. But it’s working. And if you’ve been having the same weird problem with PHP, maybe it will work for you.

Previous: « || Next: »

Leave a Reply

Comments (RSS).  RSS icon