On Ubuntu, the code to enable PHP is contained in the package libapache2-mod-php5. It adds two files to /etc/apache2/mods-available/, php5.conf and php5.load, and creates symbolic links to those files in /etc/apache2/mods-enabled/. Look at the code in php5.conf. It begins with
which tells Apache to invoke the PHP module, loaded in php5.load, for files ending in appropriate extensions like .php, .php5, .php?, or the very old .phtml. (The matching template is a "regular expression.")
I don't know whether you are in charge of the server on which your scripts are run. But if you use an Ubuntu server, make sure you have these files. If not, install the libapache2-mod-php5 package, or use tasksel to install Apache2, PHP5, and MySQL5.