# apache 2.0.63 crash on restart ... php related (very old problem)



## edhunter (Dec 10, 2008)

Hello

I know this has been discussed on lists and other forums, but so far I cant get rid of this issue.
The problem is that apache crashes (but no every time) I run apachectl restart. I understand that this is related to php and may be to the order of extensions in extensions.ini. Yesterday I updated php and extensions from 5.2.6 to 5.2.8. I hoped that this could be fixed . But now I still have this issue. I have used a script to fix order of extensions (here it is: http://www.pingle.org/2007/09/22/php-crashes-extensions-workaround ), but it didnt help me too.

Here are some details:

```
#:> uname -a
FreeBSD test.--mydomain--.bg 7.0-STABLE FreeBSD 7.0-STABLE #1: Wed Jul  9 11:17:29 EEST 2008     root@test.--mydomain--.bg:/usr/obj/usr/src/sys/TESTPC  i386
```


```
#:> pkg_info | grep -i -E 'apache|php5'
apache-2.0.63_2     Version 2.0.x of Apache web server with prefork MPM.
php5-5.2.8          PHP Scripting Language
php5-ctype-5.2.8    The ctype shared extension for php
php5-gd-5.2.8       The gd shared extension for php
php5-gettext-5.2.8  The gettext shared extension for php
php5-mbstring-5.2.8 The mbstring shared extension for php
php5-mcrypt-5.2.8   The mcrypt shared extension for php
php5-mhash-5.2.8    The mhash shared extension for php
php5-mysql-5.2.8    The mysql shared extension for php
php5-mysqli-5.2.8   The mysqli shared extension for php
php5-openssl-5.2.8  The openssl shared extension for php
php5-session-5.2.8  The session shared extension for php
php5-simplexml-5.2.8 The simplexml shared extension for php
php5-snmp-5.2.8_2   The snmp shared extension for php
php5-sockets-5.2.8  The sockets shared extension for php
php5-spl-5.2.8      The spl shared extension for php
php5-xml-5.2.8      The xml shared extension for php
```


```
#:> cat /usr/local/etc/php/extensions.ini
extension=ctype.so
extension=session.so
extension=simplexml.so
extension=gd.so
extension=openssl.so
extension=mcrypt.so
extension=mhash.so
extension=gettext.so
extension=mbstring.so
extension=xml.so
extension=snmp.so
extension=spl.so
extension=mysqli.so
extension=mysql.so
extension=sockets.so
```


```
#:> cat /usr/local/etc/php.conf
PHP_VER=5
PHP_VERSION=5.2.8
PHP_SAPI=cli cgi mod
PHP_EXT_INC=pcre
```

I have this in main httpd.conf file in <Directory /> ... directive related to php error logging.

```
php_flag display_startup_errors off
    php_flag display_errors off
    php_flag html_errors on
    php_flag log_errors on
    php_flag ignore_repeated_errors off
    php_flag ignore_repeated_source off
    php_flag report_memleaks on
    php_flag track_errors on
    php_value docref_root 0
    php_value docref_ext 0
    php_value error_log /var/log/httpd-php-error.log
    php_value log_errors_max_len 0
```

and the following directives related to php in the main virtual host configuration

```
php_admin_flag register_globals on
    php_admin_flag allow_url_fopen off
    php_flag magic_quotes_gpc on
```


I can post more info or the httpd.core file if needed. Please help me to get rid of this problem

10x in advance


----------



## liamjfoy (Dec 10, 2008)

Hmm, what's the output when you use apachectl? Try and upload the httpd.core and I'll have a little look.


----------



## edhunter (Dec 10, 2008)

there is no output on console

```
#:> apachectl restart
#:>
```

from messages:

```
Dec 10 17:17:32 test kernel: pid 8836 (httpd), uid 0: exited on signal 11 (core dumped)
```

from httpd-error log:

```
[Wed Dec 10 17:17:32 2008] [notice] SIGHUP received.  Attempting to restart
[Wed Dec 10 17:17:32 2008] [notice] seg fault or similar nasty error detected in the parent process
```

here is core file: http://geo.game-host.org/attachments/httpd.core.tar.gz


----------



## p3n1x (Dec 10, 2008)

might be php related i think...

if you type php -v do you get a segfault?

for me it was the recode.so extension in extensions.ini that i had to put up top

try moving session to the top...changing the order of php extensions loading perhaps?


----------



## dh (Dec 11, 2008)

I've had crashing problems with mhash extension, try commenting that one out.


----------



## edhunter (Dec 11, 2008)

dh said:
			
		

> I've had crashing problems with mhash extension, try commenting that one out.



i commented it ... (i'm not sure if it is really needed for my webs) but i still got crash on apachectl restart.



			
				p3n1x said:
			
		

> might be php related i think...
> 
> if you type php -v do you get a segfault?
> 
> ...



i dont get segfault on php -v
i dont have recode extension...
there are too many combinations for order of extensions, in my first post i said that i have used a tool for it, that didnt help me too.


----------



## liamjfoy (Dec 11, 2008)

After a quick google there just seems to be many people with this issue and little resolve. I believe there is also a FreeBSD PR.


----------



## r-c-e (Dec 12, 2008)

What does the apache error log say? What about apachectl configtest?


----------



## edhunter (Dec 15, 2008)

@r-c-e
error log says
[Wed Dec 10 17:17:32 2008] [notice] SIGHUP received.  Attempting to restart
[Wed Dec 10 17:17:32 2008] [notice] seg fault or similar nasty error detected in the parent process

apachectl configtest says Syntax OK


----------



## p3n1x (Dec 15, 2008)

my next suggestion....this is strange

maybe move onto apache 2.2.9, is there any reason you cannot move?


----------



## p3n1x (Dec 15, 2008)

reading over this again have you tried not loading any php extensions at all? perhaps making sure it is php related. 

also that pingle.org link you had in ive used that in the past too. works great. but in the end i just stick recode and session up top. 

but we are using different versions of apache as im in on 2.2.9


----------



## edhunter (Dec 16, 2008)

@p3n1x
A few months ago I used apache 2.2 and php 5.2.6 and I had same problems, then i deinstalled 2.2 and installed 2.0 as suggested by friend. I think that this issue is not related to apache version (2.0 and 2.2 - it was same behaviour for me).
I commented all extensions - and there is no crash on apache restart, but the primary web site does not fuction properly. It is completly sure that the problem is php related.
I dont have recode. I have tried moving session on top, but it didnt help  There are realy too many combinations for the order of extensiosns.


----------



## p3n1x (Dec 16, 2008)

heres my extensions.ini file if it helps?

extension=recode.so
extension=pdf.so
extension=fileinfo.so
extension=mysql.so
extension=curl.so
extension=bz2.so
extension=ctype.so
extension=mbstring.so
extension=iconv.so
extension=tokenizer.so
extension=xml.so
extension=session.so
extension=snmp.so
extension=mhash.so
extension=bcmath.so
extension=gettext.so
extension=posix.so
extension=simplexml.so
extension=spl.so
extension=mysqli.so
extension=xmlwriter.so
extension=zlib.so
extension=gd.so
extension=pdo.so
extension=mcrypt.so
extension=openssl.so
extension=pdo_sqlite.so
extension=sockets.so
extension=calendar.so
extension=dom.so
extension=xmlreader.so
extension=sqlite.so
extension=exif.so
extension=zip.so
extension=json.so
extension=hash.so
extension=filter.so


----------



## edhunter (Dec 17, 2008)

thank you

I dont have so much extensions, but I followed the order of yours. And I did apachectl restart ... and on the 3rd restart i got BANG ((
You say that this is the order of extensions and that you are using apache 2.2.x and you dont have troubles on restart.

What version of freebsd ?

Hmm I'll move to latest apache 2.2 again and will try it again.


----------



## p3n1x (Dec 18, 2008)

freebsd 6.4 release

apache 2.2.11 (just updated ports)
php 5.28 or whatever it was. and yea.


----------



## Draug (Jan 16, 2009)

I have this problem too...
Comment extension=spl.so in php.ini, it work, but not solved problem.


----------



## cyberguss (Feb 3, 2009)

I had the same problem, looks like it is related to php extensions, 
mhash is definitely one of them.

I also had to move mysql.so to the first line and session.so to the second.
After restart Apache is no longer crashing.

Below is my /usr/local/etc/php/extensions.ini 
extension=mysql.so
extension=session.so
extension=ctype.so
extension=pcre.so
extension=simplexml.so
extension=spl.so
extension=dom.so
extension=fileinfo.so
extension=filter.so
extension=gd.so
extension=gettext.so
extension=hash.so
extension=iconv.so
extension=json.so
extension=mcrypt.so
#extension=mhash.so
extension=pdo.so
extension=pdo_sqlite.so
extension=posix.so
extension=sqlite.so
extension=tokenizer.so
extension=xml.so
extension=xmlreader.so
extension=xmlwriter.so


----------



## edhunter (Feb 5, 2009)

*solved*



			
				p3n1x said:
			
		

> my next suggestion....this is strange
> 
> maybe move onto apache 2.2.9, is there any reason you cannot move?



Actually the problem thisappeared - I moved to latest apache 2.2 from ports apache-2.2.11_3
No more crash ot apachectl restart )))))


```
#:> pkg_info | egrep 'php5-|apache'
apache-2.2.11_3     Version 2.2.x of Apache web server with prefork MPM.
php5-5.2.8          PHP Scripting Language
php5-ctype-5.2.8    The ctype shared extension for php
php5-gd-5.2.8_1     The gd shared extension for php
php5-gettext-5.2.8  The gettext shared extension for php
php5-mbstring-5.2.8 The mbstring shared extension for php
php5-mcrypt-5.2.8   The mcrypt shared extension for php
php5-mhash-5.2.8    The mhash shared extension for php
php5-mysql-5.2.8    The mysql shared extension for php
php5-mysqli-5.2.8   The mysqli shared extension for php
php5-openssl-5.2.8  The openssl shared extension for php
php5-session-5.2.8  The session shared extension for php
php5-simplexml-5.2.8 The simplexml shared extension for php
php5-spl-5.2.8      The spl shared extension for php
php5-xml-5.2.8      The xml shared extension for php
```

The order of extensions is "untouched" - how the ports installing made it.

```
#:> cat /usr/local/etc/php/extensions.ini
extension=ctype.so
extension=mysql.so
extension=session.so
extension=simplexml.so
extension=spl.so
extension=gd.so
extension=openssl.so
extension=mcrypt.so
extension=mysqli.so
extension=mhash.so
extension=gettext.so
extension=mbstring.so
extension=xml.so
extension=apc.so
```


----------

