Basically, it sounds like Apache was not configured to serve PHP scripts. Firstly, which version of Apache and PHP are you uisng, and what did you do to install them?
For my Ubuntu 7.10 slice at Slicehost I just decided to go for a no-brainer exercise and follow their instructions:
Ubuntu Gutsy - installing Apache and PHP5. Those instructions should work for you to.
Alternatively, you can try and fix this yourself by going to the httpd.conf file and adding:
AddType application/x-httpd-php .php
Save the file and restart the server.
In my case (and I am not sure if this is the case for all Ubuntu 7.10 installations), the Apache2 configuration file was at "/etc/apache2/apache2.conf" instead, and this in turn included the file "/etc/apache2/mods-enabled/php5.conf", which had the content:
<IfModule mod_php5.c>
AddType application/x-httpd-php .php .phtml .php3
AddType application/x-httpd-php-source .phps
</IfModule>
Basically the same thing, except that it includes more possible file extensions.