# How to set permission to the access for php5 ?

## etouche

Hi all,

I have this error with a simple php5 and apache2 install on my gentoo.

Forbidden

You don't have permission to access /php4-cgi/phpinfo.php on this server. 

Here my httpd.conf resume.

```

User web

Group web

```

```

<VirtualHost *:80>

        ServerName localhost

        Include /etc/apache2/vhosts.d/default_vhost.include

        <Location /var/www/localhost/htdocs/php4>

                AddHandler php4-cgi .php

        </Location>

        <Location /var/www/localhost/htdocs/php5>

                AddHandler php5-cgi .php

        </Location>

        <IfModule mpm_peruser_module>

                ServerEnvironment apache apache

        </IfModule>

</VirtualHost>

```

```
DocumentRoot "/var/www/localhost/htdocs"

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

        Options Indexes FollowSymLinks

        AllowOverride All

        # Controls who can get stuff from this server.

        Allow from all

        Order allow,deny

        Allow from all

</Directory>

```

My directories : 

```
myGentoo ~ # ls -l /var/

drwxr-xr-x  3 root root  80 Mar 18 20:37 www

myGentoo ~ # ls -l /var/www/

drwxr-xr-x 3 web web 72 Mar 18 20:37 localhost

myGentoo ~ # ls -l /var/www/localhost

drwxr-xr-x 3 web web 232 Mar 21 20:33 htdocs

myGentoo ~ # ls -l /var/www/localhost/httdocs

-rwxr-xr-x 1 web web 3638 Mar 21 18:12 favicon.ico

-rwxr-xr-x 1 web web   45 Mar 18 20:37 index.html

drwxr-xr-x 8 web web  680 Mar 21 17:59 net2ftp

-rwxrwxr-x 1 web web   20 Jan  7  1980 phpinfo.php

-rwxrwxr-x 1 web web   20 Jan  7  1980 phpinfo.php4

-rwxrwxr-x 1 web web   20 Jan  7  1980 phpinfo.php5

```

I'm very very lost because i search around the web about how to set, and nothing talk well about that, when i see the tutorials it seems to be automatically good after the installation without set nothing ...   :Crying or Very sad: 

----------

## etouche

I see that a lot people comes and check this post ... But no answer ...

Someone knows about how to set : 

=> /var/www/  

=> /var/www/localhost/

=> /var/www/localhost/htdocs/

----> owner and chmod ?

A least i thing is the first point to check.

Then the httpd.conf about the user and group settings, Directory ...

 :Arrow:  So thanks to answer at least about the directories ownership settings.   :Exclamation:   :Question:   :Idea: 

I take good tutorials too  :Wink: 

----------

