# apache2 and php5 problem

## Sergey.Katalevich

I've emerged apache2 and php. But it dosen't work.

When I start apache server I'll get 

2848 ?        Ss     0:00 /usr/sbin/apache2 -D DEFAULT_VHOST -D PHP5 -d /usr/lib/apache2 -f /etc/apache2/httpd.conf

 2866 ?        Z      0:00 [apache2] <defunct>

 2868 ?        Z      0:00 [apache2] <defunct>

 2869 ?        Z      0:00 [apache2] <defunct>

What should I do ?

----------

## psycepa

```

apache2ctl configtest

```

or sth very similar to test your configuration

----------

## Sergey.Katalevich

# apache2ctl configtest

Syntax OK

But when I remove "-D PHP5" option from /etc/conf.d/apache2 file Apache works well. No zombie like this  2866 ? Z 0:00 [apache2] <defunct> 

Zombie processes appear because php. 

I tried to reemerge different version php5 but always get the same result =>  2866 ? Z 0:00 [apache2] <defunct>

----------

## psycepa

```

virtual przyczepa # emerge -pv php

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

Calculating dependencies... done!

[ebuild   R   ] dev-lang/php-5.1.6-r6  USE="apache apache2 berkdb calendar cjk cli crypt curl gd gdbm gmp iconv mhash mysql mysqli ncurses nls odbc pcre postgres readline reflection session soap spell spl sqlite ssl tokenizer truetype unicode xml xmlreader xmlrpc xmlwriter xpm xsl zip zlib ll spl sqlite ssl tokenizer truetype unicode xml xmlrea`der xmlrpc xmlwriter xpm xsl zip zlib 

virtual przyczepa # emerge -pv apache

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

Calculating dependencies... done!

[ebuild   R   ] net-www/apache-2.0.59-r1  USE="apache2 ssl -debug -doc -ldap -mpm-itk -mpm-leader -mpm-peruser -mpm-prefork -mpm-threadpool -mpm-worker (-selinux) -static-modules -threads" 0 kB

```

and it works, try to compare use flags, check if you merged php with apache2 use flag and so on...

----------

## Sergey.Katalevich

```
[ebuild   R   ] net-www/apache-2.0.59  USE="apache2 -debug -doc -ldap -mpm-itk -mpm-leader -mpm-peruser -mpm-prefork -mpm-threadpool -mpm-worker (-selinux) -ssl -static-modules -threads (-no-suexec%)" 0 kB

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

I've emerged apache and php with apache2 use flag. But it doesn't work.

I'll still get 

```
848 ? Ss 0:00 /usr/sbin/apache2 -D DEFAULT_VHOST -D PHP5 -d /usr/lib/apache2 -f /etc/apache2/httpd.conf

2866 ? Z 0:00 [apache2] <defunct>

2868 ? Z 0:00 [apache2] <defunct>

2869 ? Z 0:00 [apache2] <defunct> 
```

----------

## psycepa

can you post you httpd.conf file? of course get rid of lines starting with # to make it humanreadable  :Smile: 

and maybe that will help ya: http://forums.vpslink.com/showthread.php?t=563

----------

## Sergey.Katalevich

```
ServerRoot "/usr/lib/apache2"

PidFile "/var/run/apache2.pid"

Timeout 300

KeepAlive On

MaxKeepAliveRequests 100

KeepAliveTimeout 15

<IfModule prefork.c>

    StartServers         5

    MinSpareServers      5

    MaxSpareServers     10

    MaxClients         150

    MaxRequestsPerChild  0

</IfModule>

<IfModule worker.c>

    StartServers         2

    MaxClients         150

    MinSpareThreads     25

    MaxSpareThreads     75

    ThreadsPerChild     25

    MaxRequestsPerChild  0

</IfModule>

<IfModule perchild.c>

    NumServers           5

    StartThreads         5

    MinSpareThreads      5

    MaxSpareThreads     10

    MaxThreadsPerChild  20

    MaxRequestsPerChild  0

</IfModule>

<IfModule peruser.c>

    ServerLimit          256

    MaxClients           256

    MinSpareProcessors     2

    MaxProcessors         10

    MaxRequestsPerChild 1000

    ExpireTimeout       1800

    Multiplexer nobody nobody

    Processor apache apache

</IfModule>

Listen 80

LoadModule access_module                 modules/mod_access.so

LoadModule auth_module                   modules/mod_auth.so

LoadModule auth_anon_module              modules/mod_auth_anon.so

LoadModule auth_dbm_module               modules/mod_auth_dbm.so

LoadModule auth_digest_module            modules/mod_auth_digest.so

LoadModule charset_lite_module           modules/mod_charset_lite.so

LoadModule env_module                    modules/mod_env.so

LoadModule expires_module                modules/mod_expires.so

LoadModule headers_module                modules/mod_headers.so

LoadModule mime_module                   modules/mod_mime.so

LoadModule negotiation_module            modules/mod_negotiation.so

LoadModule setenvif_module               modules/mod_setenvif.so

LoadModule log_config_module             modules/mod_log_config.so

LoadModule logio_module                  modules/mod_logio.so

LoadModule cgi_module                    modules/mod_cgi.so

LoadModule cgid_module                   modules/mod_cgid.so

LoadModule suexec_module                 modules/mod_suexec.so

LoadModule alias_module                  modules/mod_alias.so

LoadModule rewrite_module                modules/mod_rewrite.so

<IfDefine USERDIR>

    LoadModule userdir_module            modules/mod_userdir.so

</IfDefine>

<IfDefine INFO>

    LoadModule info_module               modules/mod_info.so

    LoadModule status_module             modules/mod_status.so

</IfDefine>

LoadModule actions_module                modules/mod_actions.so

LoadModule autoindex_module              modules/mod_autoindex.so

LoadModule dir_module                    modules/mod_dir.so

LoadModule ext_filter_module             modules/mod_ext_filter.so

LoadModule deflate_module                modules/mod_deflate.so

LoadModule include_module                modules/mod_include.so

<IfDefine PROXY>

    LoadModule proxy_module                  modules/mod_proxy.so

    LoadModule proxy_connect_module          modules/mod_proxy_connect.so

    LoadModule proxy_ftp_module              modules/mod_proxy_ftp.so

    LoadModule proxy_http_module             modules/mod_proxy_http.so

</IfDefine>

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

User apache

Group apache

ServerAdmin root@localhost

ServerName info.alk

UseCanonicalName Off

<Directory />

    Options FollowSymLinks

    AllowOverride None

</Directory>

<IfModule mod_userdir.c>

    UserDir public_html

    <Directory /home/*/public_html>

        AllowOverride FileInfo AuthConfig Limit Indexes

        Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec

        <Limit GET POST OPTIONS PROPFIND>

            Order allow,deny

            Allow from all

       </Limit>

       <LimitExcept GET POST OPTIONS PROPFIND>

            Order deny,allow

            Deny from all

       </LimitExcept>

    </Directory>

</IfModule>

DirectoryIndex index.html index.html.var

AccessFileName .htaccess

<Files ~ "^\.ht">

    Order allow,deny

    Deny from all

</Files>

TypesConfig /etc/mime.types

DefaultType text/plain

<IfModule mod_mime_magic.c>

    MIMEMagicFile /etc/apache2/magic

</IfModule>

HostnameLookups Off

ErrorLog logs/error_log

LogLevel warn

CustomLog logs/access_log common

ServerTokens Prod

ServerSignature On

ScriptAlias /cgi-bin/ /var/www/cgi-bin/

<Directory "/var/www/cgi-bin/">

    AllowOverride None

    Options None

    Order allow,deny

    Allow from all

</Directory>

<IfModule mod_autoindex.c>

    IndexOptions FancyIndexing VersionSort

    AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip

    AddIconByType (TXT,/icons/text.gif) text/*

    AddIconByType (IMG,/icons/image2.gif) image/*

    AddIconByType (SND,/icons/sound2.gif) audio/*

    AddIconByType (VID,/icons/movie.gif) video/*

    AddIcon /icons/binary.gif .bin .exe

    AddIcon /icons/binhex.gif .hqx

    AddIcon /icons/tar.gif .tar

    AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv

    AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip

    AddIcon /icons/a.gif .ps .ai .eps

    AddIcon /icons/layout.gif .html .shtml .htm .pdf

    AddIcon /icons/text.gif .txt

    AddIcon /icons/c.gif .c

    AddIcon /icons/p.gif .pl .py

    AddIcon /icons/f.gif .for

    AddIcon /icons/dvi.gif .dvi

    AddIcon /icons/uuencoded.gif .uu

    AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl

    AddIcon /icons/tex.gif .tex

    AddIcon /icons/bomb.gif core

    AddIcon /icons/back.gif ..

    AddIcon /icons/hand.right.gif README

    AddIcon /icons/folder.gif ^^DIRECTORY^^

    AddIcon /icons/blank.gif ^^BLANKICON^^

    DefaultIcon /icons/unknown.gif

</IfModule>

AddType application/x-compress .Z

AddType application/x-gzip .gz .tgz

AddHandler type-map var

BrowserMatch "Mozilla/2" nokeepalive

BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0

BrowserMatch "RealPlayer 4\.0" force-response-1.0

BrowserMatch "Java/1\.0" force-response-1.0

BrowserMatch "JDK/1\.0" force-response-1.0

BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully

BrowserMatch "^WebDrive" redirect-carefully

BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully

BrowserMatch "^gnome-vfs" redirect-carefully

<IfDefine INFO>

    ExtendedStatus On

    <Location /server-status>

        SetHandler server-status

        Order deny,allow

        Deny from all

        Allow from localhost

    </Location>

</IfDefine>

<IfDefine INFO>

    <Location /server-info>

       SetHandler server-info

       Order deny,allow

       Deny from all

       Allow from localhost

    </Location>

</IfDefine>

Include /etc/apache2/vhosts.d/*.conf

```

And this is  error_log

```

[Tue Oct 31 12:16:07 2006] [error] cgid daemon process died, restarting

[Tue Oct 31 12:16:07 2006] [notice] child pid 6545 exit signal Segmentation fault (11)

```

----------

## psycepa

errors from log seems to indicate problems with mod_cgid, 

i don't know exactly the issue, maybe google will tell more, but if you can, try to replace mod_cgi by something other, like in case of php you can use built_in php or mod_php, so in case of cgi there should also be an escape route  :Smile: 

besides, if google will tell alot if you search for this cgi error, i'm not able to give you a simple answer since i don't know on what machine you are working and so on, but at least I can give you some hints, hope this helps

greetz

----------

