Local Apache server will sot serve PHP files
jkossen at xs4all.nl
Sun Jan 1 15:41:34 UTC 2006
On Sun, Jan 01, 2006 at 11:31:40PM +0900, Dave M G wrote:
> Ubuntu Users,
> I have Ubuntu 5.10, Apache 2.0, PHP4 (?), and MySQL on my home machine,
> a P3. It is not a web server, but I am intending to use it for testing
> my web pages before uploading them by FTP to my hosting service.
> I installed PHP4 via Symantic, and so far as I knew, there was no
> further set up needed. However, I am encountering two problems with PHP
> scripts which indicate PHP is either not actually installed, or
> installed incorrectly.
You also need the Apache module, libapache2-mod-php4 (or
libapache-mod-php4 if you use Apache 1.3.x).
> In the case of PHP embedded in an html file, the PHP simply does not
> display. I created a file called "test.html", which contains inside the
> PHP code: <? phpinfo(); ?>. I save the file to my /var/www directory,
> and view it in Firefox at localhost. Nothing shows up on screen.
That's because html files aren't parsed as php files in the standard
> In the case of .php scripts, I created a file called index.php and put
> it in its own directory within /var/www. However, when I try to call it,
> I get a message from Firefox which says I am trying to open a "PHTML"
> file, and would I like to save it or open it with another application.
> Is there some configuration with my Apache server settings that needs
> to be altered?
> While I am comfortable writing PHP code, I am a newbie when it comes to
> installing it, and this is one of my first attempts to install my own
> PHP testing environment at home.
> Any advice would be much appreciated.
The php module is probably not enabled. Ubuntu/Debian provides a handy
little script called a2enmod. something like a2enmod php4 should work.
Jochem Kossen - http://jkossen.nl
More information about the ubuntu-users