# Apache (PHP) fails to start

## musv

Hi there, 

after the last system update my apache refuses to start. There are no vhosts, nothing professional. It's a simple home net configuration, which means, it's the default configuration. 

```
 /etc/init.d/apache2 start

 * Caching service dependencies ...                                       [ ok ]

 * apache2 has detected an error in your setup:

[Wed Apr 11 10:07:35.367567 2012] [core:warn] [pid 14877:tid 140516044105536] AH00111: Config variable ${SVN_REPOS_LOC} is not defined

[Wed Apr 11 10:07:35.367808 2012] [core:warn] [pid 14877:tid 140516044105536] AH00111: Config variable ${SVN_REPOS_LOC} is not defined

apache2: Syntax error on line 140 of /etc/apache2/httpd.conf: Syntax error on line 4 of /etc/apache2/modules.d/70_mod_php5.conf: Cannot load /usr/lib64/apache2/modules/libphp5.so into server: /usr/lib64/apache2/modules/libphp5.so: undefined symbol: unixd_config

 * ERROR: apache2 failed to start
```

Line 140 of httpd.conf

```
Include /etc/apache2/modules.d/*.conf
```

Line 4 of 70_mod_php5.conf

```
LoadModule php5_module    modules/libphp5.so
```

Installed is:

- php-5.4.1_rc1

- apache-2.4.1-r2

Any ideas? revdep-rebuild assured me, that my system would be in a consistent state.

----------

## theotherjoe

```
eselect php list apache2
```

should print the list of currently installed versions

of php apache2 modules. In your case only php5.4 

should be in the output.

In case you dont have any output make sure the

apache2 use flag is used for php compilation/installation.

you could also have a look in /usr/lib/apache2/modules

for libphp5.so which should be a symlink to the apache module

for the currently selected php version.

----------

## geki

you may follow the migration, changes listed in this bugreport: https://bugs.gentoo.org/show_bug.cgi?id=410607

i.e.: undefined symbol: unixd_config

-> needs in httpd.conf: LoadModule unixd_module modules/mod_unixd.so

----------

## binro

I have just hit this problem despite reading this thread first and following the advice! I still get:

```

 * apache2 has detected an error in your setup:

[Sat Dec 01 22:25:45.997063 2012] [core:warn] [pid 18018] AH00111: Config variable ${SVN_REPOS_LOC} is not defined

[Sat Dec 01 22:25:45.997185 2012] [core:warn] [pid 18018] AH00111: Config variable ${SVN_REPOS_LOC} is not defined

apache2: Syntax error on line 179 of /etc/apache2/httpd.conf: Syntax error on line 4 of /etc/apache2/modules.d/70_mod_php5.conf: Cannot load modules/libphp5.so into server: /usr/lib64/apache2/modules/libphp5.so: undefined symbol: unixd_config

 * ERROR: apache2 failed to start

```

I included unixd in the APACHE_MODULES variable and the correct LoadModule statement is in httpd.conf and the modules exist in /usr/lib/apache2/modules. So any idea what else is missing?

TIA

----------

## Art Vandalay

 *binro wrote:*   

> I have just hit this problem despite reading this thread first and following the advice! I still get:
> 
> ```
> 
>  * apache2 has detected an error in your setup:
> ...

 

Hi, 

Having the same issue....where you able to solve this? and what version of apache and php are you using?

----------

## binro

No solution as yet, I am still using apache-2.2.23. The failing version is 2.4.3; php is 5.3.15.

----------

## websterr

I found that the /usr/lib/apache2/modules/libphp5.so was soft linked to the a non existent file.

 ls -l  /usr/lib/apache2/modules/libphp5.so

lrwxrwxrwx 1 root root 34 Mar 15  2011 /usr/lib/apache2/modules/libphp5.so -> /usr/lib/php5.3/apache2/libphp5.so

It seems that upon upgrading to php5.4 this link was not changed once I linked to the right file I was able to start apache2.

ls -l  /usr/lib/apache2/modules/libphp5.so

lrwxrwxrwx 1 root root 50 Dec 20 15:28 /usr/lib/apache2/modules/libphp5.so -> /usr/lib/php5.4/usr/lib/apache2/modules/libphp5.so

----------

## binro

I seem to have both php-5.3 and php-5.4 installed. I will try changing the link and see what happens. Thanks for the tip!

----------

## binro

You can use "eselect php list" to choose which php to use, I found out. However, neither works for me, I still get the error. Apache-2.3 is hard-masked now on my system.

----------

## jasonaward

I had this problem with Apache 2.4.3 and PHP 5.4.9.  The solution was to re-build PHP.  

Did you actually re-build PHP or just rely on revrep-rebuild to check consistency?

----------

## binro

 *jasonaward wrote:*   

> I had this problem with Apache 2.4.3 and PHP 5.4.9.  The solution was to re-build PHP.  
> 
> Did you actually re-build PHP or just rely on revrep-rebuild to check consistency?

 

Thanks, that was the solution! Of course I thought about rebuilding php (usually fixes a lot of things on Gentoo) but assumed that because php was dynamically selectable, the two packages were independent. Obviously not! Thanks again.  :Smile: 

----------

## heheman3000

I had this problem with apache 2.4.6-r2 and php-5.5.2. Doing

```

emerge -1av php

```

fixed the problem. revdep-rebuild didn't find anything.

----------

## sunhaowei

I also encounter this problem

Cannot load modules/libphp5.so into server: /opt/rh/httpd24/root/etc/httpd/modules/libphp5.so: undefined symbol: unixd_config

httpd24 and php5.5.23

----------

## freke

 *sunhaowei wrote:*   

> I also encounter this problem
> 
> Cannot load modules/libphp5.so into server: /opt/rh/httpd24/root/etc/httpd/modules/libphp5.so: undefined symbol: unixd_config
> 
> httpd24 and php5.5.23

 

You've tried re-emerging PHP? ie.

```
emerge -1av php
```

----------

## Krog

same problem here, I reinstalled apache and php

```
 eselect php list apache2

  [1]   php5.5

  [2]   php5.6 *

```

```
/etc/init.d/apache2 restart

 * Caching service dependencies ...                                                                                               [ ok ]

 * apache2 has detected an error in your setup:

apache2: Syntax error on line 180 of /etc/apache2/httpd.conf: Syntax error on line 7 of /etc/apache2/modules.d/70_mod_php.conf: Syntax error on line 2 of /var/lib/eselect-php/mod_php.conf: Cannot load modules/mod_php.so into server: /usr/lib64/apache2/modules/mod_php.so: undefined symbol: unixd_config

 * ERROR: apache2 failed to start

```

----------

## Syl20

Which USE flags did you use for apache and php ?

----------

## Krog

 *Syl20 wrote:*   

> Which USE flags did you use for apache and php ?

 

```
[ebuild   R    ] www-servers/apache-2.4.18:2::gentoo  USE="ldap ssl threads -debug -doc (-libressl) (-selinux) -static -suexec" APACHE2_MODULES="actions alias asis auth_basic auth_digest authn_alias authn_anon authn_core authn_dbd authn_dbm authn_file authz_core authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cern_meta charset_lite dav dav_fs dav_lock dbd deflate dir dumpio env expires ext_filter file_cache filter headers ident imagemap include info log_config log_forensic logio mime mime_magic negotiation proxy proxy_ajp proxy_connect proxy_ftp proxy_http rewrite setenvif socache_shmcb speling status substitute unique_id unixd userdir usertrack version vhost_alias -access_compat -authz_dbd -cache_disk -cgi -cgid -http2 -lbmethod_bybusyness -lbmethod_byrequests -lbmethod_bytraffic -lbmethod_heartbeat -macro -proxy_balancer -proxy_fcgi -proxy_html -proxy_scgi -proxy_wstunnel -ratelimit -remoteip -reqtimeout -slotmem_shm" APACHE2_MPMS="-event -peruser -prefork -worker" 5084 KiB

```

```
[ebuild   R    ] dev-lang/php-5.5.34:5.5::gentoo  USE="apache2 berkdb bzip2 cgi cjk cli crypt ctype curl exif fileinfo filter fpm ftp gd gdbm hash iconv inifile json ldap mysql mysqli nls opcache pdo phar posix readline session simplexml sockets spell sqlite ssl threads tokenizer truetype unicode xml xmlwriter zip zlib -bcmath -calendar -cdb -debug -embed -enchant (-firebird) -flatfile (-frontbase) -gmp -imap -intl -iodbc -ipv6 -kerberos -ldap-sasl -libedit -libmysqlclient -mhash -mssql -oci8-instant-client -odbc -pcntl -postgres -qdbm -recode (-selinux) -sharedmem -snmp -soap -sybase-ct -systemd -sysvipc -tidy -vpx -wddx -xmlreader -xmlrpc -xpm -xslt" 13366 KiB

```

thanks for the help

----------

## Syl20

Certainly a dumb question, but... As you show the USE flags for php _5.5_, are you sure you recompiled php _5.6_ after upgrading apache ?

----------

## Krog

 *Syl20 wrote:*   

> Certainly a dumb question, but... As you show the USE flags for php _5.5_, are you sure you recompiled php _5.6_ after upgrading apache ?

 

DOH! ssh to house pc NOW... i will let you know  :Razz: 

edit:

this is indeed strange:

```
emerge --unmerge --pretend php

 * This action can remove important packages! In order to be safer, use

 * `emerge -pv --depclean <atom>` to check for reverse dependencies before

 * removing packages.

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

 dev-lang/php

    selected: 5.5.34 5.6.17

   protected: none

     omitted: none
```

but if I do: 

```
 emerge =dev-lang/php-5.6.17 --oneshot

These are the packages that would be merged, in order:

Calculating dependencies       ... done!

emerge: there are no ebuilds to satisfy "=dev-lang/php-5.6.17".
```

emerging dev-lang/php-5.6.19

----------

## Krog

SOLVED! thanks!!

I also had to add "ServerName localhost" to my httpd.conf to suppress a warning

strange that emerge @preserved-rebuild or revdep-rebuild did not complain about this, or portage did not offered an upgrade or downgrade of php 5.6... 

probably would be a good idea to let portage automatically rebuild php after an update of apache

----------

## Syl20

dev-lang/php-5.6.17 has been removed from portage, so the message from emerge is normal.

Have a look on your world file and on your package.mask file(s), maybe there are some limitations on the 5.6 versions.

If you don't use it, you should unmerge php 5.5.

Concerning the auto-update of php after apache, why not, but, in your case, the problem was the update from apache 2.2.x to apache 2.4.x. Minor versions updates don't need so much care.

----------

