Problem: php not working with apache on RedHat 9.0

Margaret Doll Margaret_Doll at brown.edu
Tue Jul 13 15:56:33 UTC 2004


I am not able to get php working with apache on
RedHat 9.0.  I have read through the php documentation.  I am starting
through the apache documentation.  Any ideas as to the problem?

uname -r
2.4.20-30.9

httpd -l
Compiled in modules:
   core.c
   prefork.c
   http_core.c
   mod_so.c

In /etc/httpd/conf/httpd.conf I added the next line after the loading 
of the other modules.

LoadModule php4_module modules/libphp4.so

The AddType statements were already in /etc/httpd/conf/httpd/conf

DirectoryIndex index.html index.htm index.shtml index.php index.php4 
index.php3 index.cgi
<IfModule mod_php4.c>
   AddType application/x-httpd-php .php4 .php3 .phtml .php
   AddType application/x-httpd-php-source .phps
<IfModule mod_php3.c>
   AddType application/x-httpd-php3 .php3
   AddType application/x-httpd-php3-source .phps
<IfModule mod_php.c>
   AddType application/x-httpd-php .phtml

When I added the "AddModule" list as suggested in the php document 
listed below,
httpd wouldn't start.

"Apache 1.3 configuration directives found
  please read /usr/share/doc/httpd-2.0.40/migration.html"

I tried to view two test.php files

more mad.php
<html>
<head></head>
<body>
<?php
$myvar = "Hello World";
         echo( $myvar);
?>
</body>
</html>

I get a blank screen on this file.

   and
more test.php
<?php phpinfo(); ?>

I get a screen with "<?php phpinfo(); ?>" typed
exactly on it.

rpm -aq | grep httpd
httpd-2.0.40-21.9
redhat-config-httpd-1.0.1-18
httpd-manual-2.0.40-21.9
[root at chemps Software]# rpm -aq | grep php
php-imap-4.2.2-17.2
php-4.2.2-17.2
php-ldap-4.2.2-17.2
php-pgsql-4.2.2-17.2
php-mysql-4.2.2-17.2


-rwxr-xr-x    1 apache   apache         93 Jul 13 10:45 mad.php

from  us2.php.net/manual

4.  Unix: I installed PHP using RPMS, but Apache isn't processing the 
PHP pages! What's going on here?

Assuming you installed both Apache and PHP from RPM packages,        
you need to uncomment or add some or all of the following lines       
in your httpd.conf file:

# Extra Modules
AddModule mod_php.c
AddModule mod_php3.c
AddModule mod_perl.c

# Extra Modules
LoadModule php_module         modules/mod_php.so
LoadModule php3_module        modules/libphp3.so     # for PHP 3
LoadModule php4_module        modules/libphp4.so     # for PHP 4
LoadModule perl_module        modules/libperl.so
And add:

AddType application/x-httpd-php3 .php3    # for PHP 3
AddType application/x-httpd-php .php      # for PHP 4
... to the global properties, or to the properties of the        
VirtualDomain you want to have PHP support added to.

7. Unix/Windows: I have installed PHP, but when I try to       access a 
PHP script file via my browser, I get a blank screen.

Do a 'view source' in the web browser and you will probably       find 
that you can see the source code of your PHP script.       This means 
that the web server did not send the script to       PHP for 
interpretation. Something is wrong with the server       configuration 
- double check the server configuration against       the PHP 
installation instructions.



More information about the redhat-list mailing list