# A couple Apache Issues

## anfpunk

I'm running:

[ebuild   R   ] net-www/apache-2.0.53  +apache2* -debug -doc -ldap -mpm-leader -mpm-peruser -mpm-prefork -mpm-threadpool -mpm-worker -no-suexec +ssl -static-modules -threads 0 kB 

[ebuild   R   ] dev-php/mod_php-5.0.3  -adabas +apache2 -bcmath +berkdb -birdstep -bzlib -calendar -cdb -cpdflib +crypt -ctype -curl -curlwrappers -db2 +dba -dbase -dbm -dbmaker -dbx -debug -dio -empress -empress-bcs -esoob -exif -fam -fdftk -filepro -firebird -flatfile -frontbase -ftp -gd -gd-external -gdbm -gmp -hyperwave-api -iconv -imap -informix -ingres -inifile -iodbc -jpeg -kerberos -ldap -libedit -mcve -memlimit -mhash -mime -ming -mnogosearch -msession -msql -mssql +mysql -mysqli +ncurses -nis +nls -oci8 -odbc -oracle7 -ovrimos -pcntl -pcre -pfpro -png -posix -postgres -qdbm +readline -recode -sapdb -sasl -session -sharedext -sharedmem -simplexml -snmp -soap -sockets -solid -spell -spl -sqlite +ssl -sybase -sybase-ct -sysvipc -tidy -tiff -tokenizer -truetype -wddx +xml2 -xmlrpc -xpm -xsl +zlib 0 kB 

Whenever I go to the default PHP page it just tries to have me download the file.  However if I manually type in domain/index.php it parses the file.  I've been searching and trying to think of what I've forgotten.  

Also perl and python files try to download instead of letting me view the text when I go to the folder.

Here is my httpd.conf file.  What am I missing?

```

# Do NOT add a slash at the end of the directory path.

ServerRoot "/usr/lib/apache2"

PidFile "/var/run/apache2.pid"

Timeout 300

KeepAlive On

MaxKeepAliveRequests 100

KeepAliveTimeout 15

StartServers         2

MinSpareServers      2

MaxSpareServers      3

MaxClients           5

MaxRequestsPerChild  0

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 suexec_module                 modules/mod_suexec.so

LoadModule alias_module                  modules/mod_alias.so

LoadModule rewrite_module                modules/mod_rewrite.so

LoadModule actions_module                modules/mod_actions.so

LoadModule autoindex_module              modules/mod_autoindex.so

LoadModule dir_module                    modules/mod_dir.so

LoadModule status_module                 modules/mod_status.so

LoadModule ext_filter_module             modules/mod_ext_filter.so

LoadModule deflate_module                modules/mod_deflate.so

LoadModule include_module                modules/mod_include.so

#Include conf/modules.d/*.conf

#ExtendedStatus On

User apache

Group apache

ServerAdmin root@localhost

ServerName myispsucks.com

UseCanonicalName Off

<Directory />

    Options FollowSymLinks

    AllowOverride None

</Directory>

DirectoryIndex index.php

AccessFileName .htaccess

<Files ~ "^\.ht">

    Order allow,deny

    Deny from all

</Files>

TypesConfig /etc/apache2/mime.types

DefaultType text/plain

# The mod_mime_magic module allows the server to use various hints from the

# contents of the file itself to determine its type.  The MIMEMagicFile

# directive tells the module where the hint definitions are located.

#<IfModule mod_mime_magic.c>

#    MIMEMagicFile /etc/apache2/magic

#</IfModule>

HostnameLookups Off

ErrorLog logs/error_log

LogLevel warn

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

LogFormat "%h %l %u %t \"%r\" %>s %b" common

LogFormat "%{Referer}i -> %U" referer

LogFormat "%{User-agent}i" agent

CustomLog logs/access_log common

ServerTokens Full

ServerSignature Off

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

NameVirtualHost *:80

<VirtualHost *:80>

    DocumentRoot "/var/www/localhost/htdocs"

    <Directory "/var/www/localhost/htdocs">

        # http://httpd.apache.org/docs-2.0/mod/core.html#options

        Options Indexes FollowSymLinks

        AllowOverride None

        Order allow,deny

        Allow from all

    </Directory>

</VirtualHost>

LoadModule php5_module    modules/libphp5.so

AddType application/x-httpd-php .php

AddType application/x-httpd-php .phtml

AddType application/x-httpd-php .php3

AddType application/x-httpd-php .php4

AddType application/x-httpd-php .php5

AddType application/x-httpd-php-source .phps

```

Thanks for the help.

----------

## splooge

Did you add -D PHP4 to /etc/conf.d/apache2?

----------

## anfpunk

 *splooge wrote:*   

> Did you add -D PHP4 to /etc/conf.d/apache2?

 

I added -D PHP5 but I shouldn't need it since I added the php loadmodule and associated lines directly in httpd.conf

----------

## anfpunk

anyone?

----------

## dataking

I'm having similar issues, only with PHP4.  I've combed these forums as much as is reasonable, and have seen too many people with the same problem.  I'm guessing the answer is to download and build from source.  For some reason, emerging these packages doesn't seem to work.  

If anyone could provide some guidance, that would be great.  I would be willing to post httpd.conf etc, if required, but didn't mean to totally steal anfpunk's thread.  Been thinking about starting my own, maybe if you get enough people posting threads about the same thing, some of the Gentoo/emerge gurus will take notice.

----------

## wjholden

Look in /var/log/apache/error_log and see if there are any records of a segmentation fault or something along those lines.

----------

## dataking

 *destuxor wrote:*   

> Look in /var/log/apache/error_log and see if there are any records of a segmentation fault or something along those lines.

 

Snippet of error_log after /etc/init.d/apache2 restart:

```
[Thu Apr 21 20:20:55 2005] [notice] Digest: generating secret for digest authentication ...

[Thu Apr 21 20:20:55 2005] [notice] Digest: done

[Thu Apr 21 20:20:56 2005] [notice] Apache/2.0.52 (Gentoo/Linux) DAV/2 PHP/4.3.11 configured -- resuming normal operations

```

----------

## wjholden

Do the restart and then view your .php file using a webbrowser and see if there's any error message after that.

----------

## dataking

This time I get this:

```
[Thu Apr 21 20:34:20 2005] [error] [client 127.0.0.1] File does not exist: /var/www/localhost/htdocs/favicon.ico

```

I doubt this is related.  I tried to access the page again from the locahost, and from another system.  Got the same results all three times - the browser tried to download the file.

----------

## wjholden

The favicon.ico is the little icon you see in your address bar in Firefox (or other webbrowser).  Example.

See if adding this line to your httpd.conf helps:

```
LoadModule php4_module                   extramodules/libphp4.so
```

----------

## dataking

That line is in there.

Here's the config:

```

ServerTokens OS

ServerRoot "/etc/apache2"

PidFile "/var/run/apache2.pid"

TimeOut 300

KeepAlive true

MaxKeepAliveRequests 100

KeepAliveTimeout 15

<IfModule prefork.c>

        StartServers 8

        MinSpareServers 5

        MaxSpareServers 20

        MaxClients 50

        MaxRequestsPerChild 100

</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>

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 include_module modules/mod_include.so

LoadModule log_config_module modules/mod_log_config.so

LoadModule env_module modules/mod_env.so

LoadModule mime_magic_module modules/mod_mime_magic.so

LoadModule cern_meta_module modules/mod_cern_meta.so

LoadModule expires_module modules/mod_expires.so

LoadModule headers_module modules/mod_headers.so

LoadModule usertrack_module modules/mod_usertrack.so

LoadModule unique_id_module modules/mod_unique_id.so

LoadModule setenvif_module modules/mod_setenvif.so

LoadModule mime_module modules/mod_mime.so

LoadModule dav_module modules/mod_dav.so

LoadModule status_module modules/mod_status.so

LoadModule autoindex_module modules/mod_autoindex.so

LoadModule asis_module modules/mod_asis.so

LoadModule info_module modules/mod_info.so

LoadModule dav_fs_module modules/mod_dav_fs.so

LoadModule vhost_alias_module modules/mod_vhost_alias.so

LoadModule negotiation_module modules/mod_negotiation.so

LoadModule dir_module modules/mod_dir.so

LoadModule imap_module modules/mod_imap.so

LoadModule actions_module modules/mod_actions.so

LoadModule speling_module modules/mod_speling.so

LoadModule userdir_module modules/mod_userdir.so

LoadModule alias_module modules/mod_alias.so

LoadModule rewrite_module modules/mod_rewrite.so

LoadModule proxy_module modules/mod_proxy.so

LoadModule proxy_ftp_module modules/mod_proxy_ftp.so

LoadModule proxy_http_module modules/mod_proxy_http.so

LoadModule proxy_connect_module modules/mod_proxy_connect.so

LoadModule cache_module modules/mod_cache.so

LoadModule disk_cache_module modules/mod_disk_cache.so

LoadModule file_cache_module modules/mod_file_cache.so

LoadModule mem_cache_module modules/mod_mem_cache.so

LoadModule cgi_module modules/mod_cgi.so

LoadModule php4_module extramodules/libphp4.so

User apache

Group apache

ServerAdmin root@localhost

ServerName gentoo

Include conf/commonapach2.conf

UseCanonicalName on

DocumentRoot "/var/www/localhost/htdocs"

<IfModule mod_userdir.c>

    UserDir "disable"

</IfModule>

DirectoryIndex

AccessFileName .htaccess

<Files ~ "^\.ht">

    Order allow,deny

    Deny from all

</Files>

TypesConfig "/etc/mime.types"

DefaultType text/plain

<IfModule mod_mime_magic.c>

    MIMEMagicFile conf/magic

</IfModule>

php_value file_uploads 1

HostNameLookups Off

ErrorLog "/var/log/apache2/error_log"

LogLevel warn

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

LogFormat "%h %l %u %t \"%r\" %>s %b" common

LogFormat "%{Referer}i -> %U" referer

LogFormat "%{User-agent}i" agent

CustomLog logs/access_log combined

ServerSignature on

<IfModule mod_dav_fs.c>

        DAVLockDB /var/lib/dav/lockdb

</IfModule>

<IfModule mod_cgid.c>

</IfModule>

IndexOptions FancyIndexing VersionSort NameWidth=*

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

ReadmeName README.html

HeaderName HEADER.html

AddEncoding x-compress Z

AddEncoding x-gzip gz tgz

AddLanguage da .dk

AddLanguage nl .nl

AddLanguage en .en

AddLanguage et .et

AddLanguage fr .fr

AddLanguage de .de

AddLanguage he .he

AddLanguage el .el

AddLanguage it .it

AddLanguage ja .ja

AddLanguage pl .po

AddLanguage kr .kr

AddLanguage pt .pt

AddLanguage nn .nn

AddLanguage no .no

AddLanguage pt-br .pt-br

AddLanguage ltz .ltz

AddLanguage ca .ca

AddLanguage es .es

AddLanguage sv .se

AddLanguage cz .cz

AddLanguage ru .ru

AddLanguage tw .tw

AddLanguage zh-tw .tw

AddLanguage hr .hr

LanguagePriority en da nl et fr de el it ja kr no pl pt pt-br ltz ca es sv tw

ForceLanguagePriority Prefer Fallback

AddDefaultCharset ISO-8859-1

AddCharset ISO-8859-1  .iso8859-1  .latin1

AddCharset ISO-8859-2  .iso8859-2  .latin2 .cen

AddCharset ISO-8859-3  .iso8859-3  .latin3

AddCharset ISO-8859-4  .iso8859-4  .latin4

AddCharset ISO-8859-5  .iso8859-5  .latin5 .cyr .iso-ru

AddCharset ISO-8859-6  .iso8859-6  .latin6 .arb

AddCharset ISO-8859-7  .iso8859-7  .latin7 .grk

AddCharset ISO-8859-8  .iso8859-8  .latin8 .heb

AddCharset ISO-8859-9  .iso8859-9  .latin9 .trk

AddCharset ISO-2022-JP .iso2022-jp .jis

AddCharset ISO-2022-KR .iso2022-kr .kis

AddCharset ISO-2022-CN .iso2022-cn .cis

AddCharset Big5        .Big5       .big5

AddCharset WINDOWS-1251 .cp-1251   .win-1251

AddCharset CP866       .cp866

AddCharset KOI8-r      .koi8-r .koi8-ru

AddCharset KOI8-ru     .koi8-uk .ua

AddCharset ISO-10646-UCS-2 .ucs2

AddCharset ISO-10646-UCS-4 .ucs4

AddCharset UTF-8       .utf8

AddCharset GB2312      .gb2312 .gb

AddCharset utf-7       .utf7

AddCharset utf-8       .utf8

AddCharset big5        .big5 .b5

AddCharset EUC-TW      .euc-tw

AddCharset EUC-JP      .euc-jp

AddCharset EUC-KR      .euc-kr

AddCharset shift_jis   .sjis

AddType application/x-tar .tgz

AddHandler imap-file map

AddHandler type-map var

AddHandler php4-script php

AddOutputFilter INCLUDES .shtml

Alias /error/ "/var/www/error/"

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

NameVirtualHost *:80

LockFile "/var/lock/apache2.lock"

CoreDumpDirectory "/etc/apache2"

<VirtualHost *:80>

        ServerName gentoo

        UseCanonicalName on

        DocumentRoot "/var/www/localhost/htdocs"

        ServerAdmin root@localhost

        DirectoryIndex index.php index.cgi index.html index.htm index.shtml

        LogLevel debug

        HostNameLookups off

</VirtualHost>

<Directory "/">

        Options FollowSymLinks

        AllowOverride None

</Directory>

<Directory "/var/www/icons">

        Options Indexes MultiViews

        AllowOverride None

        Allow from all

        Order allow,deny

</Directory>

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

        Options ExecCGI

        AllowOverride None

        Allow from all

        Order allow,deny

</Directory>

<Directory "/var/www/usage">

        Options Indexes Includes FollowSymLinks

        AllowOverride None

        Allow from all

        Order allow,deny

</directory>

```

And the 'commonapach2.conf':

```

User apache

Group apache

ServerAdmin root@localhost

<Directory />

  Options -All -Multiviews

  AllowOverride None

  <IfModule mod_access.c>

    Order deny,allow

    Deny from all

  </IfModule>

</Directory>

<IfModule mod_userdir.c>

    UserDir public_html

</IfModule>

<IfModule mod_dir.c>

    DirectoryIndex index.html index.html.var index.php index.php3 index.shtml index.cgi index.pl index.htm Default.htm default.htm

</IfModule>

AccessFileName .htaccess

<IfModule mod_access.c>

<Files ~ "^\.ht">

    Order allow,deny

    Deny from all

</Files>

</IfModule>

UseCanonicalName On

<IfModule mod_mime.c>

    TypesConfig conf/mime.types

</IfModule>

DefaultType text/plain

<IfModule mod_mime_magic.c>

    MIMEMagicFile conf/magic

</IfModule>

HostnameLookups Off

EnableMMAP on

<IfModule mod_log_config.c>

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

LogFormat "%h %l %u %t \"%r\" %>s %b" common

LogFormat "%{Referer}i -> %U" referer

LogFormat "%{User-agent}i" agent

LogFormat "%v %h %l %u %t \"%r\" %>s %b %T" script

LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" VLOG=%{VLOG}e" vhost

    <IfModule mod_logio.c>

        LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio

    </IfModule>

</IfModule>

ServerTokens Full

ServerSignature On

<IfModule mod_alias.c>

    Alias /icons/ /var/www/localhost/icons/

    Alias /doc /usr/share/doc

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

    ScriptAlias /protected-cgi-bin/ /var/www/localhost/protected-cgi-bin/

    ScriptAliasMatch ^/~([^/]*)/cgi-bin/(.*) /home/$1/public_html/cgi-bin/$2

    <IfModule mod_perl.c>

        Alias /perl/ /var/www/localhost/perl/

        Alias /cgi-perl/ /var/www/localhost/perl/

    </IfModule>

</IfModule>

<IfModule mod_autoindex.c>

    IndexOptions FancyIndexing VersionSort NameWidth=*

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

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

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

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

    AddIconByType (VID,/icons/movie.png) 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 .bz2

    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 .php .php3

    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

    ReadmeName README.html

    HeaderName HEADER.html

</IfModule>

<IfModule mod_mime.c>

    AddEncoding x-compress Z

    AddEncoding x-gzip gz tgz

    AddLanguage ca .ca

    AddLanguage cz .cz

    AddLanguage da .dk

    AddLanguage de .de

    AddLanguage el .el

    AddLanguage en .en

    AddLanguage es .es

    AddLanguage et .ee

    AddLanguage fr .fr

    AddLanguage he .he

    AddLanguage hr .hr

    AddLanguage it .it

    AddLanguage ja .ja

    AddLanguage ko .ko

    AddLanguage kr .kr

    AddLanguage ltz .ltz

    AddLanguage ltz .lu

    AddLanguage nl .nl

    AddLanguage nn .nn

    AddLanguage no .no

    AddLanguage pl .po

    AddLanguage pt-br .pt-br

    AddLanguage pt .pt

    AddLanguage ru .ru

    AddLanguage sv .se

    AddLanguage tw .tw

    AddLanguage zh-tw .tw

    AddDefaultCharset ISO-8859-1

    <IfModule mod_negotiation.c>

        LanguagePriority en fr de es it da nl et el ja kr no pl pt pt-br ru ltz ca sv tw

    </IfModule>

    <IfModule mod_negotiation.c>

        ForceLanguagePriority Prefer Fallback

    </IfModule>

    AddCharset ISO-8859-1  .iso8859-1  .latin1

    AddCharset ISO-8859-2  .iso8859-2  .latin2 .cen

    AddCharset ISO-8859-3  .iso8859-3  .latin3

    AddCharset ISO-8859-4  .iso8859-4  .latin4

    AddCharset ISO-8859-5  .iso8859-5  .latin5 .cyr .iso-ru

    AddCharset ISO-8859-6  .iso8859-6  .latin6 .arb

    AddCharset ISO-8859-7  .iso8859-7  .latin7 .grk

    AddCharset ISO-8859-8  .iso8859-8  .latin8 .heb

    AddCharset ISO-8859-9  .iso8859-9  .latin9 .trk

    AddCharset ISO-2022-JP .iso2022-jp .jis

    AddCharset ISO-2022-KR .iso2022-kr .kis

    AddCharset ISO-2022-CN .iso2022-cn .cis

    AddCharset Big5        .Big5       .big5

    AddCharset WINDOWS-1251 .cp-1251   .win-1251

    AddCharset CP866       .cp866

    AddCharset KOI8-r      .koi8-r .koi8-ru

    AddCharset KOI8-ru     .koi8-uk .ua

    AddCharset ISO-10646-UCS-2 .ucs2

    AddCharset ISO-10646-UCS-4 .ucs4

    AddCharset UTF-8       .utf8

    AddCharset GB2312      .gb2312 .gb

    AddCharset utf-7       .utf7

    AddCharset utf-8       .utf8

    AddCharset big5        .big5 .b5

    AddCharset EUC-TW      .euc-tw

    AddCharset EUC-JP      .euc-jp

    AddCharset EUC-KR      .euc-kr

    AddCharset shift_jis   .sjis

    AddType application/x-tar .tgz

    AddType image/x-icon .ico

    AddType application/x-httpd-php .php

    AddType application/x-httpd-php .phtml

    AddType application/x-httpd-php .php3

    AddType application/x-httpd-php .php4

    AddType application/x-httpd-php-source .phps

    AddHandler cgi-script .cgi

    AddHandler type-map var

    AddType text/html .shtml

    AddOutputFilter INCLUDES .shtml

    AddHandler imap-file map

</IfModule>

<Location /manual>

    Options Multiviews

    ErrorDocument 404 "The document you requested has not been installed on your system."

</Location>

<IfModule mod_setenvif.c>

    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 "^gnome-vfs" redirect-carefully

    BrowserMatch "^WebDAVFS" redirect-carefully

</IfModule>

<IfModule mod_status.c>

    <Location /server-status>

        SetHandler server-status

        <IfModule mod_access.c>

          Order deny,allow

          Deny from all

          allow from 127.0.0.1

        </IfModule>

    </Location>

</IfModule>

<IfModule mod_info.c>

    <Location /server-info>

        SetHandler server-info

        <IfModule mod_access.c>

        Order deny,allow

        Deny from all

        allow from 127.0.0.1

        </IfModule>

    </Location>

</IfModule>

<IfModule mod_perl.c>

    <Location /perl-status>

        SetHandler perl-script

        <IfDefine MODPERL2>

        PerlResponseHandler Apache::Status

        </IfDefine>

        <IfDefine !MODPERL2>

        PerlResponseHandler ModPerl::Status

        </IfDefine>

        <IfModule mod_access.c>

          Order deny,allow

          Deny from all

          Allow from 127.0.0.1

        </IfModule>

    </Location>

</IfModule>

<IfModule mod_include.c>

</IfModule>

<IfModule mod_deflate.c>

    <Directory "/var/www/localhost/htdocs/manual">

      AddOutputFilterByType DEFLATE text/html

    </Directory>

</IfModule>

<Directory /var/www/localhost/htdocs>

    Options -Indexes FollowSymLinks MultiViews

    AllowOverride All

    <IfModule mod_access.c>

      Order allow,deny

      Allow from all

    </IfModule>

</Directory>

<Directory /var/www/localhost/perl>

    AllowOverride All

    Options -Indexes FollowSymLinks MultiViews ExecCGI

    <IfModule mod_access.c>

      Order allow,deny

      Allow from all

    </IfModule>

</Directory>

<IfModule mod_cgid.c>

</IfModule>

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

    AllowOverride All

    Options ExecCGI

    <IfModule mod_access.c>

      Order allow,deny

      Allow from all

    </IfModule>

</Directory>

<Directory /var/www/localhost/protected-cgi-bin>

    AllowOverride All

    Options ExecCGI

    <IfModule mod_access.c>

      Order deny,allow

      Deny from all

      Allow from 127.0.0.1

    </IfModule>

</Directory>

<Directory /home/*/public_html>

    AllowOverride All

    Options MultiViews -Indexes Includes FollowSymLinks

    <IfModule mod_access.c>

      Order allow,deny

      Allow from all

    </IfModule>

</Directory>

<Directory /home/*/public_html/cgi-bin>

     Options +ExecCGI -Includes -Indexes

     SetHandler cgi-script

</Directory>

<IfModule mod_perl.c>

    <Directory /home/*/public_html/perl>

        SetHandler perl-script

        PerlResponseHandler ModPerl::PerlRun

        Options -Indexes ExecCGI

        <IfDefine MODPERL2>

          PerlOptions +ParseHeaders

        </IfDefine>

        <IfDefine !MODPERL2>

          PerlSendHeader On

        </IfDefine>

    </Directory>

</IfModule>

<Directory /var/www/localhost/icons>

    Options -Indexes MultiViews

    AllowOverride None

    <IfModule mod_access.c>

      Order allow,deny

      Allow from all

    </IfModule>

</Directory>

<Directory /usr/share/doc>

    <IfModule mod_deflate.c>

      AddOutputFilterByType DEFLATE text/html

    </IfModule>

    Options Indexes FollowSymLinks

    <IfModule mod_access.c>

      Order deny,allow

      Deny from all

      Allow from 127.0.0.1

    </IfModule>

</Directory>

<Location /index.shtml>

    Options +Includes

</Location>

<IfModule mod_perl.c>

    PerlModule Apache2::ModPerl::Registry

    <Location  "^/perl/*.pl>

        SetHandler perl-script

        <IfDefine MODPERL2>

        PerlResponseHandler Apache2::ModPerl::Registry

        </IfDefine>

        <IfDefine !MODPERL2>

        PerlResponseHandler ModPerl::Registry

        </IfDefine>

        Options -Indexes ExecCGI

        PerlSendHeader On

    </Location>

    <Location /cgi-perl/*.pl>

        SetHandler perl-script

        PerlResponseHandler ModPerl::PerlRun

        Options -Indexes ExecCGI

        PerlSendHeader On

    </Location>

</IfModule>

<IfModule mod_alias.c>

AliasMatch ^/manual(?:/(?:de|en|fr|ja|ko|ru))?(/.*)?$ "/var/www/localhost/htdocs/manual/$1"

</IfModule>

<Directory "/var/www/localhost/htdocs/manual">

    Options Indexes

    AllowOverride None

    Order allow,deny

    Allow from all

    <Files *.html>

        SetHandler type-map

    </Files>

    SetEnvIf Request_URI ^/manual/de/ prefer-language=de

    SetEnvIf Request_URI ^/manual/en/ prefer-language=en

    SetEnvIf Request_URI ^/manual/fr/ prefer-language=fr

    SetEnvIf Request_URI ^/manual/ja/ prefer-language=ja

    SetEnvIf Request_URI ^/manual/ko/ prefer-language=ko

    SetEnvIf Request_URI ^/manual/ru/ prefer-language=ru

    RedirectMatch 301 ^/manual(?:/(de|en|fr|ja|ko|ru)){2,}(/.*)?$ /manual/$1$2

</Directory>

```

I hate putting posts this long, but I'd like to stick with the ebuild and not have to do this from source.

----------

## wjholden

Nobody cares about long posts (you did us a courtesy removing comments though, it doesn't look too good when someone dumps their entire xorg.conf w/ comments into a post).

Try commenting the line out now, for some reason mine's commented out.  I don't know why, but it works.

EDIT: look at /etc/conf.d/apache2 .

----------

## dataking

I had the line 

```
php_value file_uploads 1
```

in the config from an earlier attempt at getting it working.  I assume that this presets a PHP environment variable.  When I removed the 'LoadModule' line, I get an error:

```

 * Apache2 has detected a syntax error in your configuration files:

Syntax error on line 106 of /etc/apache2/conf/apache2.conf:

Invalid command 'php_value', perhaps mis-spelled or defined by a module not included in the server configuration

```

This is expected, and when I remove line apache starts up fine.  

But, still no PHP.

----------

## wjholden

Have you looked in /etc/conf.d/apache2 yet?  I remember now that the new ebuilds put their APACHE_OPTS variable in there.  If -D PHP4 isn't in there that could explain why this isn't working.

----------

## dataking

Yup, I added that.

Also, when the module is enabled (LoadModule directive present), the server signature is this:

```
Apache/2.0.52 (Gentoo/Linux) DAV/2 PHP/4.3.11 Server at gentoo Port 80
```

When, it's commented out, the "PHP/4.3.11" isn't there.  Again, this is expected behavior.  It just doesn't make sense why this isn't working.  Just for shits and giggles, here's the output from 

```
<?php phpinfo() ?>
```

---

(It works fine on the command line)

```

PHP Version => 4.3.11

System => Linux gentoo 2.6.11-gentoo-r5 #5 SMP Sun Apr 10 15:40:12 PDT 2005 i686

Build Date => Apr 19 2005 17:51:53

Configure Command =>  './configure' '--prefix=/usr' '--host=i686-pc-linux-gnu' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--datadir=/usr/share' '--sysconfdir=/etc' '--localstatedir=/var/lib' '--disable-cgi' '--enable-cli' '--with-ndbm=/usr' '--with-db4=/usr' '--with-mcrypt=/usr' '--with-mhash=/usr' '--without-interbase' '--without-ming' '--without-swf' '--without-sybase' '--with-gdbm=/usr' '--without-fdftk' '--with-java=/opt/blackdown-jdk-1.4.2.01' '--without-mcal' '--without-unixODBC' '--with-pgsql=/usr' '--without-snmp' '--with-xpm-dir=/usr/X11R6' '--without-gmp' '--without-mssql' '--with-pdflib=/usr' '--with-gd' '--enable-gd-native-ttf' '--with-png=/usr' '--with-png-dir=/usr' '--with-jpeg=/usr' '--with-jpeg-dir=/usr' '--enable-exif' '--with-tiff=/usr' '--with-tiff-dir=/usr' '--with-mysql=/usr' '--with-mysql-sock=/var/run/mysqld/mysqld.sock' '--with-freetype-dir=/usr' '--with-ttf=/usr' '--with-t1lib=/usr' '--with-gettext' '--with-qtdom=/usr/qt/3' '--with-pspell=/usr' '--with-openssl=/usr' '--without-imap' '--with-ldap=/usr' '--with-dom=/usr' '--with-dom-xslt=/usr' '--with-dom-exslt=/usr' '--without-kerberos' '--with-pam' '--disable-memory-limit' '--disable-ipv6' '--without-yaz' '--disable-debug' '--with-curlwrappers' '--with-curl=/usr' '--enable-dbx' '--with-zlib=/usr' '--with-zlib-dir=/usr' '--with-sablot=/usr' '--enable-xslt' '--with-xslt-sablot' '--with-xmlrpc' '--enable-wddx' '--with-xml' '--enable-mbstring=all' '--enable-mbregex' '--with-bz2=/usr' '--with-crack=/usr' '--with-cdb' '--enable-pcntl' '--enable-bcmath' '--enable-calendar' '--enable-dbase''--enable-filepro' '--enable-ftp' '--with-mime-magic=/usr/share/misc/file/magic.mime' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--with-iconv' '--enable-shmop' '--enable-dio' '--enable-yp' '--with-readline=/usr' '--with-ncurses=/usr' '--enable-inline-optimization' '--enable-track-vars' '--enable-trans-sid' '--enable-versioning' '--with-config-file-path=/etc/php/cli-php4' '--libdir=/usr/lib/php'

Server API => Command Line Interface

Virtual Directory Support => disabled

Configuration File (php.ini) Path => /etc/php/cli-php4/php.ini

PHP API => 20020918

PHP Extension => 20020429

Zend Extension => 20021010

Debug Build => no

Thread Safety => disabled

Registered PHP Streams => php, http, ftp, https, ftps, compress.bzip2, compress.zlib

This program makes use of the Zend Scripting Language Engine:

Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

 

----------

## dataking

FWIW, I finally got this working.

For anyone else that seems to be banging into the same wall, I was, this is how I did it.

Made sure this line was in /etc/conf.d/apache2:

```
APACHE2_OPTS="-D PHP4 -D SSL"
```

Commented out all php references in apache2.conf and commonapach2.conf (including the LoadModule line in apache.conf)

Added the following to apache2.conf:

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

Restart apache2.

Thanks to all those who offered help.  Really odd that the exact same directives in /etc/apache2/modules.d/70_mod_php.conf couldn't work in the apache2.conf or the commonapach2.conf.  But, atleast its working now.   :Very Happy: 

----------

