Last week, I posted a message on this list. I had been having trouble getting PHP4 to work with Apache 2 on RedHat 8. My test page was not being parsed by PHP, and server-info did not show any information on PHP.

The Apache Migration HOWTO had the answer.

When configuring Apache for PHP, there are three differences between Apache 1.3 and Apache 2.0.

1. The standard httpd.conf now contains Include conf.d/*.conf. The file conf.d/php.conf contains the LoadModule statement for php.

2. Instead of the AddType application/x-httpd-php .php, you must include the following in httpd.conf (or php.conf)

<Files *.php>
        SetOutputFilter PHP
        SetInputFilter PHP
</Files>

3. My test file which contained
<? phpinfo() ?>
must now contain instead
<?php phpinfo() ?>
as short open tags are now disabled.


An interesting distraction I discovered was this: php comes with two model configuration files, php.ini-dist, and php.ini-recommended. Apache2 /PHP4 was configured with php.ini-recommended, Netscape 7 running on Solaris could not display it, but Netscape 4.79 could. The problem disappeared when I used php.ini-dist.


php.ini-recommended contains the comments

; This is the recommended, PHP 4-style version of the php.ini-dist file. It
; sets some non standard settings, that make PHP more efficient, more secure,
; and encourage cleaner coding.
; The price is that with these settings, PHP may be incompatible with some
; applications, and sometimes, more difficult to develop with. Using this
; file is warmly recommended for production sites.


So, be careful with php.ini-recommended!

Dick

--
Richard Gillman
iTSS UNIX Systems Group, Maclean Building, Wallingford OX10 8BB
Tel: 01491 - 692 339



Reply via email to