Configuring PHP with Apache2

Hal Burgiss hal at
Tue Apr 13 02:52:56 UTC 2010

On Mon, Apr 12, 2010 at 10:26 PM, Ray Parrish <crp at> wrote:
> Hello,
> i want to set up; PHP on my Hardy Heron box with Apache2 so that I can
> begin learning to make dynamic web sites with PHP. However, I have so
> far been unsuccesfull in getting my first simple PHP file to run.
> I am getting the following error -
>>   Forbidden
>> You don't have permission to access /info.php on this server.

What php packages are installed? A basic install on Ubuntu should
"just work" without any fiddling. I'd consider doing a purge and
starting over.

My limited experience with broken php installs is that you get
prompted to download the file. I would tend to think a Forbidden error
was more of an access configuration and not so much something php

>> ------------------------------------------------------------------------
>> Apache/2.2.8 (Ubuntu) Server at Port 80
> And here is my /etc/apache2/conf.d/php.conf file -
> <IfModule mod_php5.c>
>  AddType application/x-httpd-php .php
>  AddType application/x-httpd-php-source .phps
> </IfModule>
> <Files *.php>
> SetOutputFilter PHP
> SetInputFilter PHP
> LimitRequestBody 9524288
> </Files>
> DirectoryIndex index.php
> And my /etc/apache2/httpd.conf file -
> AddHandler cgi-script .php
> Include conf.d/*.conf
> <Directory /var/www>
> Options +ExecCGI
> </Directory>

There are 2 ways to run php, as a module (mod_php), and as a cgi. You
probably don't want to do both, and most people would say as a module
is preferrable.

Be sure to reload apache when making changes to php or apache configs too.


More information about the ubuntu-users mailing list