php5-5.2.3_1 / website behaves as if not enabled in httpd.conf

Ian Smith smithi at nimnet.asn.au
Tue Sep 11 22:13:46 PDT 2007


On Tue, 11 Sep 2007 19:19:32 +0200 Zbigniew Szalbot wrote:

 > I decided to upgrade my home machine to php5.2.3 from 4.4.7. All went
 > fine. I had one error about hash extension already loaded which I
 > solved by deleting a duplicated entry from extensions.ini. The curious
 > thing is that once apache has been restarted, if I want to load a
 > website which resides on this box, it behaves as if no php was enabled
 > in apache. In other words I can see the directory content (files
 > present in a given directory) despite index.php being there. What is
 > more strange is that when I click reload, the website is indeed loaded
 > into browser! So when I first type an URL, it shows directory content.
 > After hitting reload in browser (tested with both FF and IE), the page
 > is shown.

Except for the reload bit - perhaps I never tried that - I've been here.

 > My first thought was checking httpd.conf
 > 
 >         <IfModule mod_php5.c>
 >             DirectoryIndex index.php index.php3 index.html
 >         </IfModule>
 > 
 > and also
 >     AddType application/x-tar .tgz
 >     AddType application/x-httpd-php .php
 >     AddType application/x-httpd-php-source .phps

The latter AddTypes should be within <IfModule mod_mime.c> section?

index.php3 there looks a bit odd, unless you're supporting some old
.php3 scripts? If you're then still having trouble, show us the whole
<IfModule mod_dir.c> .. </IfModule> section? 

For a php4 to php5 update, make sure you also have such as:

#LoadModule php4_module	libexec/apache/libphp4.so
LoadModule php5_module	libexec/apache/libphp5.so

and

#AddModule mod_php4.c
AddModule mod_php5.c

And check that /usr/local/libexec/apache/libphp5.so exists!

 > So I am a bit stuck as to what may cause this strange behaviour. I am running:
 > PHP 5.2.3 with Suhosin-Patch 0.9.6.2 (cli) (built: Sep 11 2007 17:36:31)
 > Copyright (c) 1997-2007 The PHP Group
 > Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

Just checking, did you build php5 from the port, specifically selecting
the Apache module in options?  The silly php5 package doesn't include
it, as the default php5 option is to NOT build the Apache module!

here, despite my older version: 'pkg_info | grep php5' shows:
php5-5.2.0          PHP Scripting Language (Apache Module and CLI)
[..]                                        ^^^^^^^^^^^^^^^^^

 > Server version: Apache/1.3.37 (Unix)
 > Server built:   Jun 27 2007 07:58:38
 > 
 > FreeBSD 6.2-RELEASE-p6 #4
 > /usr/obj/usr/src/sys/SZALBOT
 > 
 > httpd-error.log does not show any error despite having error_reporting
 >  =  E_ALL & ~E_NOTICE set in php.ini.

>From your later message:

 > My next (not so brillian thought) was to refresh apache. And when I
 > now try to start apache, I get core dumps..
 > 
 > Sep 11 21:47:45 szalbot kernel: pid 71766 (httpd), uid 0: exited on
 > signal 11 (core dumped)
 > $ httpd -v
 > Server version: Apache/1.3.39 (Unix)
 > Server built:   Sep 11 2007 20:48:37
 > 
 > I guess I should be asking on the apache list by now?

The upgrade to 1.3.39 might have trashed your php mods to httpd.conf,
especially as they might not have been quite right already, but I'd
ignore advice to go to apache2 - unless you want to anyway - as this is
just a configuration problem I think, and a not too uncommon one either.

You could try rebuilding php5 (starting with make clean; make config; 
to be certain that the non-default apache module is selected).  The php5
install should then add the right magic at the right places to your new
httpd.conf.

Cheers, Ian



More information about the freebsd-questions mailing list