Ubuntu Server 14.04
PHP code showing on the page instead of being executed
The reason that I met this problem is because the PHP file I used begin with (<?) instead of (<?php) which the short tag is deprecated by default.
Find php.ini in /etc/php5/apache2, make sure the option short_open_tag=On, if not, change if to On.
Another solution more complete from stack overflow : http://stackoverflow.com/a/5121589/740546