# Apache2 Problems (With PHP)

## Ian

I'm trying to setup a Gentoo Linux server (not the first one I've done) to run Apache2 + mod_php to setup a website for myself.  I'm having some trouble though.

http://130.215.233.79

That's the website, and from what I can tell, even the default apache page is broken (shouldn't it have the apache logo somewhere?)  If you append a "/gallery/" to that, you get another problem, this one PHP specific.  I know that session_id() is a legal function, because I've used it before and I've checked the documentation, yet for some reason I get this error:

Fatal error: Call to undefined function session_id() in /var/www/localhost/htdocs/gallery/session.php on line 39

Everything is default, nothing has been touched, so it should all work no problem.  Any ideas?

----------

## Ian

I figured out the gallery problem, now my problem is that Apache2 is set to the default extremely restrictive settings, and no matter what I do, it doesn't seem to listen to me and allow anything to be run correctly.

For instance:

http://130.215.233.79/gallery/index.php

That should work, but doesn't.  I haven't a clue why, worked fine the last time I tried this (over half a year ago, so things obviously changed).

----------

## hanj

Hello

Looks like you are using php5. The session problem is related to a new USE flag related to sessions.

re-emerge mod_php...

```

ACCEPT_KEYWORDS="~x86" USE="session" emerge -pv mod_php
```

I would also recommend changing some of the values.. to not display so much information.. in commonapache.conf

```

ServerTokens Prod

ServerSignature Off

```

As far as the restriction on the directory.. I would create a directive for that directory... maybe in vhosts.conf

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

        RewriteEngine On

        RewriteCond %{REQUEST_METHOD} ^TRACE

        RewriteRule .* - [F]

        ErrorDocument 404 /index.php

        ErrorDocument 403 /index.php

        ErrorDocument 401 /index.php

        Options Includes -FollowSymLinks IncludesNoExec +SymLinksIfOwnerMatch

        AllowOverride AuthConfig

        DirectoryIndex index.php index.htm

        <Limit GET POST>

                Order Allow,Deny

                Allow from all

        </Limit>

</Directory>
```

The Order allow,deny...allow from all should fix your other problem.

I hope this helps 

hanji

----------

## Ian

PHP works, but I'm still getting errors trying to actually reach any page other than an index.*, and if I type in "/gallery/index.php" it'll actually give me an error (where as "/gallery/" gives me the index gallery page).  Any ideas?

----------

## imbiea

when running gallery/setup   and waiting a LONG time... you will see that you need to add these lines to your /etc/apache2/httpd.conf file:

Try that...

```

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

   AllowOverride Options FileInfo

</Directory>

```

----------

