# Apache: root gives text dir listing, php served as txt, etc

## Arla

After an upgrade from 2.2.6 (I think) to 2.2.8, pointing a browser to http://localhost/ just gives me a listing of the index files there, in the following format:

```
URI: index.html.ca

Content-language: ca

Content-type: text/html

URI: index.html.cz.iso8859-2

Content-language: cs

Content-type: text/html;charset=ISO-8859-2

...
```

Also, http://localhost/~arla is not found (I used it before the upgrade as well) and PHP scripts are served as text.

I have the following in /etc/make.conf as recommended by http://www.gentoo.org/proj/en/apache/doc/upgrading.xml

```
APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias"
```

----------

## Desintegr

Check in /etc/conf.d/apache2 if PHP5 and USERDIR modules are activated.

----------

## Arla

 *Desintegr wrote:*   

> Check in /etc/conf.d/apache2 if PHP5 and USERDIR modules are activated.

 /etc/conf.d/apache2 looked like this:

```
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D LANGUAGE -D SSL -D SSL_DEFAULT_VHOST -D php5 -D php5 -D php5 -D php5"
```

I changed it to:

```
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D LANGUAGE -D SSL -D SSL_DEFAULT_VHOST -D PHP5 -D USERDIR"
```

Now PHP and userdir works, but http://localhost/ still just lists the files.

----------

## magic919

Post 

emerge --info

----------

## iandoug

hi 

Dunno if this is related, but since a recent update world, (and sorting out the openrc networking issues), apache no longer wants to start.

It complains thusly:

```

gentoo ~ # apache2ctl start

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

Syntax error on line 22 of /etc/apache2/vhosts.d/00_moviesite.conf:

Invalid command 'php_admin_flag', perhaps misspelled or defined by a module not included in the server configuration

 * ERROR: apache2ctl failed to start

```

The line in question is:

```

    php_admin_flag engine on 

```

Which of course has worked for years.

So I assume that for some reason Apache is not loading what it needs for PHP to work...

```

APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias"

```

```

APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D LANGUAGE -D SSL -D SSL_DEFAULT_VHOST -D SUEXEC -D PHP5"

```

```

<IfDefine PHP5>

   # Load the module first

   <IfModule !mod_php5.c>

      LoadModule php5_module    modules/libphp5.so

   </IfModule>

   # Set it to handle the files

   <IfModule mod_mime.c>

      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

   </IfModule>

   DirectoryIndex index.php index.phtml

</IfDefine>

```

Anything else you need to see?

All suggestions gratefully received  :Smile: 

thanks, Ian

----------

## iandoug

hi guys

okay, ignore the above message, apache started fine after I rebooted the machine. Don't know what was different between reboot start and normal start.

Odd.

Noticed that pure-ftpd is now not starting, suppose that's a topic for another thread.

Also, having trouble setting multiple IP addresses for the machine, it only takes the last one in a list and the range selection syntax does not work either... will search the openrc threads.

IMHO, Gentoo is not suitable for production use when these kinds of issues pop up on routine upgrades... which is a pity since I want to move my server from FreeBSD to gentoo...

cheers, Ian

----------

## magic919

 *iandoug wrote:*   

> hi guys
> 
> okay, ignore the above message, apache started fine after I rebooted the machine. Don't know what was different between reboot start and normal start.
> 
> Odd.
> ...

 

I use Gentoo on production machines and I'm happy to carry on doing so.  I'd never do anything like an update world on one though...

----------

## Arla

 *magic919 wrote:*   

> Post 
> 
> emerge --info

 

```
ezekiel ~ # emerge --info

Portage 2.1.4.4 (default-linux/x86/2007.0, gcc-4.1.2, glibc-2.6.1-r0, 2.6.24-gentoo-r4 i686)

=================================================================

System uname: 2.6.24-gentoo-r4 i686 Intel(R) Pentium(R) 4 CPU 3.00GHz

Timestamp of tree: Sat, 26 Apr 2008 05:45:01 +0000

app-shells/bash:     3.2_p17-r1

dev-java/java-config: 1.3.7, 2.1.4

dev-lang/python:     2.4.4-r9

dev-python/pycrypto: 2.0.1-r6

sys-apps/baselayout: 1.12.11.1

sys-apps/sandbox:    1.2.18.1-r2

sys-devel/autoconf:  2.13, 2.61-r1

sys-devel/automake:  1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.1

sys-devel/binutils:  2.18-r1

sys-devel/gcc-config: 1.4.0-r4

sys-devel/libtool:   1.5.26

virtual/os-headers:  2.6.23-r3

ACCEPT_KEYWORDS="x86"

CBUILD="i486-pc-linux-gnu"

CFLAGS="-O2 -mtune=i686 -pipe"

CHOST="i486-pc-linux-gnu"

CONFIG_PROTECT="/etc"

CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/udev/rules.d"

CXXFLAGS="-O2 -mtune=i686 -pipe"

DISTDIR="/usr/portage/distfiles"

FEATURES="distlocks metadata-transfer sandbox sfperms strict unmerge-orphans userfetch"

GENTOO_MIRRORS="ftp://mirror.mdfnet.se/gentoo"

LANG="sv_SE.utf8"

LC_ALL="sv_SE.utf8"

LINGUAS="en sv sv_SE eo"

MAKEOPTS="-j2"

PKGDIR="/usr/portage/packages"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"

USE="X aac acl acpi alsa ao apache2 berkdb bzip2 cddb cdparanoia cjk cli cracklib crypt cups dell divx dri dvd exif firefox flac fortran gdbm gif gnome gpm gtk hal howl iconv imap immqt-bc ipv6 isdnlog java joystick jpeg latex libcaca mad matroska midi mng mp3 mpeg mudflap musepack musicbrainz mysql ncurses nls nptl nptlonly nsplugin ogg opengl openmp pam pcre perl png pppd python readline reflection samba sdl session spl ssl svg taglib tcl tcpd theora tk truetype unicode v4l v4l2 vorbis x86 xml xorg xpm xprint xsl xulrunner xv xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="mouse keyboard joystick wacom" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en sv sv_SE eo" USERLAND="GNU" VIDEO_CARDS="radeon vesa"

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
```

----------

## shoan

I upgraded world recently and get the following output on http://domain/

```

URI: index.html.ca

Content-language: ca

Content-type: text/html

URI: index.html.cz.iso8859-2

Content-language: cs

Content-type: text/html;charset=ISO-8859-2

URI: index.html.de

Content-language: de

Content-type: text/html

URI: index.html.dk

Content-language: da

Content-type: text/html

URI: index.html.ee

Content-language: ee

Content-type: text/html

URI: index.html.el

Content-language: el

Content-type: text/html

URI: index.html.en

Content-language: en

Content-type: text/html

URI: index.html.es

Content-language: es

Content-type: text/html

URI: index.html.et

Content-language: et

Content-type: text/html

URI: index.html.fr

Content-language: fr

Content-type: text/html

URI: index.html.he.iso8859-8

Content-language: he

Content-type: text/html;charset=ISO-8859-8

URI: index.html.hr.iso8859-2

Content-language: hr

Content-type: text/html;charset=ISO-8859-2

URI: index.html.it

Content-language: it

Content-type: text/html

URI: index.html.ja.iso2022-jp

Content-language: ja

Content-type: text/html;charset=ISO-2022-JP

URI: index.html.ko.euc-kr

Content-language: ko

Content-type: text/html;charset=EUC-KR

URI: index.html.ltz.utf8

Content-language: ltz

Content-type: text/html;charset=UTF-8

URI: index.html.lu.utf8

Content-language: lu

Content-type: text/html;charset=UTF-8

URI: index.html.nl

Content-language: nl

Content-type: text/html

URI: index.html.nn

Content-language: nn

Content-Type: text/html

URI: index.html.no

Content-language: no

Content-type: text/html

URI: index.html.po.iso8859-2

Content-language: pl

Content-type: text/html;charset=ISO-8859-2

URI: index.html.pt

Content-language: pt

Content-type: text/html

URI: index.html.pt-br

Content-language: pt-br

Content-type: text/html

URI: index.html.ru.cp-1251

Content-language: ru

Content-type: text/html;charset=WINDOWS-1251

URI: index.html.ru.cp866

Content-language: ru

Content-type: text/html;charset=CP866

URI: index.html.ru.iso-ru

Content-language: ru

Content-type: text/html;charset=ISO-8859-5

URI: index.html.ru.koi8-r

Content-language: ru

Content-type: text/html;charset=KOI8-r

URI: index.html.ru.utf8

Content-language: ru

Content-type: text/html;charset=UTF-8

URI: index.html.sv

Content-language: sv

Content-type: text/html

URI: index.html.zh-cn.gb2312

Content-language: zh-CN

Content-type: text/html;charset=GB2312

URI: index.html.zh-tw.big5

Content-language: tw, zh-TW

Content-type: text/html;charset=Big5

```

My make.conf looks like this.

```

localhost htdocs # cat /etc/make.conf

# These settings were set by the catalyst build script that automatically built this stage

# Please consult /etc/make.conf.example for a more detailed example

CFLAGS="-O2 -pipe"

CHOST="x86_64-pc-linux-gnu"

CXXFLAGS="${CFLAGS}"

USE="-ipv6 vhosts"

PORTDIR_OVERLAY="/usr/local/svk_overlay"

APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias"

```

```

localhost htdocs # emerge --info

Portage 2.1.4.4 (default-linux/amd64/2006.1, gcc-4.1.2, glibc-2.6.1-r0, 2.6.16.29-xen x86_64)

=================================================================

System uname: 2.6.16.29-xen x86_64 Dual Core AMD Opteron(tm) Processor 265

Timestamp of tree: Sat, 10 May 2008 05:30:01 +0000

app-shells/bash:     3.2_p33

dev-lang/python:     2.4.4-r9

dev-python/pycrypto: 2.0.1-r6

sys-apps/baselayout: 1.12.11.1

sys-apps/sandbox:    1.2.18.1-r2

sys-devel/autoconf:  2.13, 2.61-r1

sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.1

sys-devel/binutils:  2.18-r1

sys-devel/gcc-config: 1.4.0-r4

sys-devel/libtool:   1.5.26

virtual/os-headers:  2.6.23-r3

ACCEPT_KEYWORDS="amd64"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-O2 -pipe"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc"

CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/udev/rules.d"

CXXFLAGS="-O2 -pipe"

DISTDIR="/usr/portage/distfiles"

FEATURES="distlocks metadata-transfer sandbox sfperms strict unmerge-orphans userfetch"

GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"

PKGDIR="/usr/portage/packages"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY="/usr/local/svk_overlay"

SYNC="rsync://rsync.gentoo.org/gentoo-portage"

USE="amd64 berkdb cli cracklib crypt cups dri fortran gdbm gpm iconv isdnlog midi mudflap ncurses nls nptl nptlonly openmp pam pcre perl ppds pppd python readline reflection session spl ssl tcpd unicode vhosts xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="apm ark chips cirrus cyrix dummy fbdev glint i128 i810 mach64 mga neomagic nv r128 radeon rendition s3 s3virge savage siliconmotion sis sisusb tdfx tga trident tseng v4l vesa vga via vmware voodoo"

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS, MAKEOPTS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

```

Why does apache list only the files, instead of displaying the default index page?

Thanks in advance.

----------

## gammanu

I've the same problem and no solution  :Sad:  any help ?

----------

