[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Can't get PHP working - RH9, PHP4, Apache 2



Chris Hewitt wrote:
Scott Sherratt wrote:

I'm trying to get PHP running on my RH9 system, but
can't seem to get it to work.   My test php program
results in a blank browser screen (though I can see
the source), and it runs fine on at a 'hosted' site
that uses RH.  When I issue php -i > tempout.html at
the command line, I get a nice HTML file.

I understand that PHP should work without having to
compile source code.  Is there anything else I need to
configure ?

Basically I installed the RPM's, confirmed that
/etc/httpd/conf.d/php.conf contains:

####################################
# PHP is an HTML-embedded scripting language which
attempts to make it
# easy for developers to write dynamically generated
webpages.
#

LoadModule php4_module modules/libphp4.so

#
# Cause the PHP interpreter handle files with a .php
extension.
#
<Files *.php>
   SetOutputFilter PHP
   SetInputFilter PHP
   LimitRequestBody 524288
</Files>

#
# Add index.php to the list of files that will be
served as directory
# indexes.
#
DirectoryIndex index.php

####################################

Here are the RPM's that are installed:

[root srv root]# rpm -qa | grep php
php-imap-4.2.2-17.2
php-mysql-4.2.2-17.2
php-pgsql-4.2.2-17.2
php-4.2.2-17.2
php-ldap-4.2.2-17.2
php-devel-4.2.2-17.2
[root srv root]# rpm -qa | grep httpd
httpd-manual-2.0.40-21.5
redhat-config-httpd-1.0.1-18
httpd-2.0.40-21.5
[root srv root]# httpd -l
Compiled in modules:
core.c
prefork.c
http_core.c
mod_so.c

Test PHP script in /var/www/html/temp.php

<HTML>
<HEAD>
<TITLE>Test</TITLE>
</HEAD>
<BODY>
<?
/*
* Print Info
*/
phpinfo();
?>
</BODY>
</HTML>

There is nothing unusual in /var/log/messages, or
/etc/httpd/logs/error_log.  Syntax check of httpd.conf
returns OK.

Again, what else do I need to do in order to get PHP
running under RH9 & Apache 2 (other than uninstalling
RPM's and complining everything from source).  I'm
pulling my hair out!

Scott,

It should work without compiling, it does here. I notice that you have a short opening tag "<?", which will only work if you have "short_open_tag = On" in /etc/php.ini. When installing RH9 I did an install of everything so besides the rpms you quote, I also have:
php-odbc-4.2.2-17.2
asp2php-0.76.2-5
php-manual-4.2.2-17.2
php-snmp-4.2.2-17.2
asp2php-gtk-0.76.2-5
though I don't think these should make a difference. I assume your /etc/httpd/conf/httpd.conf has the:
Include conf.d/*.conf
line so that your /etc/httpd/conf.d/php.conf is included. The command line "php -i >..." test you did will use the standalone executable and not the Apache module so it will not help.


Let us know how it goes. Hoping this helps.

Don't forget that you also need the "AddModule" and "AddType" for the php scripts. Something like:

	AddModule mod_php4.c
	AddType application/x-httpd-php .php

Then, create a "test.php" script in your document root that contains
something to the effect:

	<?php
	    phpinfo();
	?>

If you access that file via:

http://localhost/test.php

you should get a pretty display of just how your PHP was configured and
how the web server is running.
----------------------------------------------------------------------
- Rick Stevens, Senior Systems Engineer     rstevens vitalstream com -
- VitalStream, Inc.                       http://www.vitalstream.com -
-                                                                    -
-      Cuteness can be overcome through sufficient bastardry         -
-                                         --Mark 'Kamikaze' Hughes   -
----------------------------------------------------------------------




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]