# "reload" crashing Apache (solved, mostly)

## Akaihiryuu

Judging by what my log says, I'm getting a segfault when I try to do /etc/init.d/apache2 reload (which calls apache2ctl -k graceful I believe).

```
[Wed Jun 21 22:18:22 2006] [notice] SIGUSR1 received.  Doing graceful restart

[Wed Jun 21 22:18:22 2006] [notice] seg fault or similar nasty error detected in the parent process

[Wed Jun 21 22:19:03 2006] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec2)

[Wed Jun 21 22:19:04 2006] [notice] Digest: generating secret for digest authentication ...

[Wed Jun 21 22:19:04 2006] [notice] Digest: done

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/lib/php/extensions/no-debug-zts-20050922/openssl.so

' - /usr/lib/php5/lib/php/extensions/no-debug-zts-20050922/openssl.so: cannot open shared object file: No such file or direc

tory in Unknown on line 0

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/lib/php/extensions/no-debug-zts-20050922/pdo.so' -

/usr/lib/php5/lib/php/extensions/no-debug-zts-20050922/pdo.so: cannot open shared object file: No such file or directory in

Unknown on line 0

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/lib/php/extensions/no-debug-zts-20050922/yaz.so' -

/usr/lib/php5/lib/php/extensions/no-debug-zts-20050922/yaz.so: cannot open shared object file: No such file or directory in

Unknown on line 0

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/lib/php/extensions/no-debug-zts-20050922/zip.so' -

/usr/lib/php5/lib/php/extensions/no-debug-zts-20050922/zip.so: cannot open shared object file: No such file or directory in

Unknown on line 0

PHP Warning:  Cannot load module 'pdo_mysql' because required module 'pdo' is not loaded in Unknown on line 0

PHP Warning:  Cannot load module 'PDO_ODBC' because required module 'pdo' is not loaded in Unknown on line 0

PHP Warning:  Cannot load module 'pdo_pgsql' because required module 'pdo' is not loaded in Unknown on line 0

[Wed Jun 21 22:19:04 2006] [warn] pid file /var/run/apache2.pid overwritten -- Unclean shutdown of previous Apache run?

[Wed Jun 21 22:19:04 2006] [notice] Apache configured -- resuming normal operations
```

Here's how Apache is compiled:

```
[ebuild   R   ] net-www/apache-2.0.55-r1  USE="apache2 doc ldap mpm-worker ssl threads -debug -mpm-leader -mpm-peruser -mpm-prefork -mpm-threadpool -no-suexec -static-modules" 0 kB
```

And here's how PHP is compiled:

```
[ebuild   R   ] dev-lang/php-5.1.4  USE="apache2 bcmath berkdb bzip2 calendar cgi cjk cli crypt ctype curl curlwrappers discard-path doc exif flatfile ftp gd gdbm gmp iconv imap inifile iodbc ipv6 kerberos ldap mhash ming mysql ncurses nls odbc pcntl pcre pdo-external pic posix postgres readline reflection sasl session sharedext snmp soap sockets spell spl ssl sysvipc threads tidy tokenizer truetype unicode xml xmlreader xmlrpc xmlwriter xsl zip zlib -adabas -apache -birdstep -cdb -db2 -dbase -dbmaker -debug -empress -empress-bcs -esoob -fastbuild -fdftk -filepro -firebird -force-cgi-redirect -frontbase -gd-external -hardenedphp -hash -hyperwave-api -informix -interbase -java-external -libedit -mcve -memlimit -msql -mssql -mysqli -oci8 -oci8-instant-client -pdo -qdbm -recode -sapdb -sharedmem -simplexml -solid -sqlite -sybase -sybase-ct -vm-goto -vm-switch -wddx -xpm -yaz" 0 kB
```

Oddly enough, I also seem to have two versions of Apache installed...I'm not sure why, but I have a 1.x version and a 3.x version.  I'm not using the 1.x version though, so that shouldn't hurt anything:

```
>>> These are the packages that would be unmerged:

 net-www/apache

    selected: 2.0.55-r1 1.3.34-r11

   protected: none

     omitted: none
```

This has been causing logrotate to crash Apache weekly, as it issues /etc/init.d/apache2 reload.  I've worked around the problem temporarily by having it issue /etc/init.d/apache2 restart instead...that way I don't get a crash.  Stop, start, and restart all work fine, and the server works fine until I try to use reload.  This is a strange problem that has been bugging me for awhile, any assistance would be appreciated.Last edited by Akaihiryuu on Thu Jul 06, 2006 2:58 pm; edited 1 time in total

----------

## lxg

According to the first code block, you seem to have a problem with some php modules.

It is well possible that you have to Apache versions: 1.3 is presumably the version you once installed, 2.0.x was installed as new slot some day. Are you sure you don't run Apache 1.3? If you didn't unmerge anything, and you haven't changed the Apache init script/config, you still run apache 1.3 (I think).

Strange enough then that you compiled PHP with apache2 support. Maybe it helps to recompile it without that USE flag?

----------

## Akaihiryuu

I'm using apache2.  I'm using the apache2 init.d script to start it, and my config files are all in /etc/apache2.  I'm not sure why 1.3 is installed, as I've never used or even attempted to start it.  That log file that I pulled came from /var/log/apache2/error_log.  So I'm definitely using apache2, and it does seem to be a PHP problem, but I'm not sure what to do to fix it.  I never thought of compiling PHP without the apache2 USE flag...wouldn't that be a bad idea since I am using apache2?  Btw, the "apache" stuff that uses 1.3 has separate things in init.d and /etc.  That uses /etc/init.d/apache, /etc/apache, and /var/log/apache.  I never set it up, when I did emerge apache originally (last October is when I set this server up), it installed both, and I only configured and ran 2.x via the apache2 stuff.  I suppose I could emerge -P apache to get rid of 1.3 and see if that makes a difference...though I'm not sure if it will.  Another possibility I just considered...when I first set the server up I DID emerge apache, but I didn't configure/start it for a short time after that.  Perhaps in the meantime, during a world update, 2.0 was installed in a new slot, but the old version wasn't removed.  That SHOULDN'T matter since I never touched /etc/apache or /etc/init.d/apache (only apache2), but I guess it couldn't hurt to remove 1.3 since I've never used it.  Come to think of it though, both versions may have been installed at the same time, because my old server that this one replaced also used apache2...I never unmaked apache 2.x on either machine, so it's likely that both versions got installed with emerge apache...perhaps I will do an emerge -epv apache and see which versions it would install to see if it installs both.  If so, I'll leave it alone, but if it only installs 2.0.x, I'll go ahead and emerge -P it to remove 1.3.

----------

## lxg

I see, what you say convices me that you use Apache 2.x.  :Wink:  Then of course the apache2 USE flag makes sense. I agree that you could uninstall v1.3, but I don't know if that would change anything.

Another thing from your above logs:

```
[Wed Jun 21 22:18:22 2006] [notice] seg fault or similar nasty error detected in the parent process 

[Wed Jun 21 22:19:03 2006] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec2) 
```

There is a remarkable time stamp difference between the "segfault" and the suexec activation. What could that mean? Is it possible that the segfault doesn't actually happen at restarting apache? Or is there such a big delay until the suexec wrapper starts?

----------

## Akaihiryuu

Ok, I uninstalled 1.3, but then emerge -uDNvp world wants to reinstall it, so I'll just let it stay there, it's in a different slot anyway.  The reason there's a timestamp difference is because, after the message that there is a segfault, I have to do killall -9 apache2, then /etc/init.d/apache2 zap, then /etc/init.d/apache2 start.  The next line you're seeing after the segfault is the server starting back up after that.  All of the PHP errors come in there during the startup.  The segfault happens immediately after /etc/init.d/apache2 reload, in which case nothing responds again until I kill/zap/start it again.  Stop, start, and restart all work fine (except for the PHP errors in error_log).

----------

## lxg

 *Akaihiryuu wrote:*   

> Ok, I uninstalled 1.3, but then emerge -uDNvp world wants to reinstall it, so I'll just let it stay there, it's in a different slot anyway.

 

Well ok, but that sounds very much as if one of your packages was build with or linked against Apache 1.3. Couldn't there be a pointer to the problem?

----------

## Akaihiryuu

I'm not sure.  If anything is the problem, it either has to be one of the USE flags I'm using for apache or something about the way I have PHP set up.

----------

## lxg

Hm, as far as I know equery doesn't distinguish versions or slots. But you could do a equery depends apache and then for each package an emerge -pte <package> to find out which package depends on the old apache. This may be vague, but it could help to solve your problem.

But ok, if you think it's alright the way it is, I won't bother any longer.

----------

## Akaihiryuu

It's no bother, I've been trying to solve this for awhile.  I just think it's odd that I can do /etc/init.d/apache restart and everything's fine, but reload crashes it.  The ONLY errors I can see are the PHP errors in error_log, and those just look like they're missing files.  That could just be something to do with how the dev-lang/php package works compared to the old dev-php/php package.  I'll try that when I get home, right now I'm at work and sadly SSH doesn't work from here so I can't get into my server to check it.

----------

## Akaihiryuu

Solved by changing "reload" to "restart" in /etc/logrotate.d/apache2

----------

