problem adding PHP to Apache on Ubuntu

Bruce Corbin brucec at goldenprs.com
Wed May 25 21:15:54 UTC 2005


I'm trying to get php installed in Apache.

Apache is running OK and serves static HTML pages with no problems.

I have done many "apt-get installs" while trying to get php to work.  
This includes
*  mysql-server
*  php4
*  php4-mysql
*  others

I have edited /etc/apache/httpd.conf to uncomment
*   AddType application/x-httpd-php  .php
*   AddType application/x-httpd-php-source  .phps

I have restarted Apache via /etc/init.d/apache restart

I created the file /var/www/test.php (chmod a+x done) containing:
<?
echo ("<h2>program test.php</h2>");
?>

I also created the file /var/www/try_php.html containing:
<HTML>
<HEAD>
<TITLE>TRY PHP INFO</TITLE>
</HEAD>
<BODY>
<H2>TRY PHP INFO</H2>
<?php
phpinfo();
?>
</BODY>
</HTML>

 From the browser "http://127.0.0.1/try_php.html"  I get the "TRY PHP 
INFO" heading text in the page "body" but I do not get any server info 
text (or any other text at all).

 From the browser "http://127.0.0.1/test.php"  I get: 'The file 
"test.php" is of type application/x-httpd-php and Mozilla does not know 
how to handle this file type'.

 From the command line:
"apache -v"    I get   server version Apache/1.3.31.
"php -v"  I get    PHP 4.3.8
"php test.php"    I get "<h2>program test.php</h2>"   (ran ok from 
command line)
"php try_php.html"   I get a total of 416 lines of information enclosed 
within my <HTML> and </HTML> tags.

Thus,  all the pieces seem to be working but I am at a loss as to what 
step I am missing to get Apache to run php.  Any suggestions?

Thank you,
Bruce







More information about the ubuntu-users mailing list