Solved: New WAMP Install Won’t Parse PHP

I spent ages trying to figure out why my new installation of WAMP Server 2 wouldn’t parse my PHP and was spitting it out exactly as-is in the source file. I hoked around in the VirtualHost configuration, because the PHPMyAdmin that comes with WAMP Server was working fine so it had to be something wrong in the VirtualHost that I just configured that was stopping .php files being sent to the PHP parser, yes? No.

As it turns out, it’s much simpler than that. Apache was sending the file to PHP to be parsed, but PHP was ignoring my code. Why? WAMP Server 2 comes with “short open tags” turned off (this may be a general PHP or PHP 5 thing, though not sure). Click WAMP -> PHP -> php.ini to edit the aforementioned file and find the line:

short_open_tag = Off

Replace Off with On et voila.

The ‘more correct’ though long-winded solution is to replace all your <? opening tags with <?php if you’re really keen (though that’ll also mean replacing <?= with <? echo). Me, I think I like my short tags.