First off let me start by saying that yes I have searched for this in google and in stackoverflow specifically, I have found many answers and tried them all. At this point I believe my only resource is posting the question myself, even if the scenario sounds repeated please be so kind as to try to help.
The situation is quite basic, on Ubuntu desktop 10.04 I set up apache via Synaptic and Php5 according to this guide and its spin-off here. At this point if I go on command line and call a php script it works, for example:
php test.php
outputs my hello world without any problem. But if I go to firefox and point to test.php it will show the 403 error Forbidden...
I have changed ownership on /var/, /var/www/ and /var/www/test.php to every variable I can think of (www-data [apache runs as this user], purefan [my regular user], root) it makes no difference, I have also changed permissions several times 777, 0777 (just to be safe), 644, 755, no change. from CLI I got the phpinfo into a file and added it here.
If Im not mistaken the problem is happening when Apache calls the php interpreter, as when I go to http://localhost/index.php it shows apache's default "It Works!" page, but if I add php content to that file it simply gets ignored, no error is shown though (also checked error log and syslog).
So please, if you have any suggestion let me know, this is not a life or dead thing but would really like to set up using worker instead of prefork.
Thank you for your time
I had exactly this same problem.. first I installed apache2 with worker mpm and php5 with fastcgi successfully under a virtual machine.. but when I tried it (using exactly the same process) on my production host, it gave me forbidden errors.
After a lot of search, I finally got it working. Here you can find the steps I've done to get it working:
These are the packages I've installed to get apache2 with mpm-worker & php5 with fastcgi:
Then you need to create a file to tell apache how to use php files. I've created one under the /etc/apache2/conf.d directory named php.conf. This should be the content:
<Directory /usr/share>
AddHandler fcgid-script .php
FCGIWrapper /usr/lib/cgi-bin/php5 .php
Options ExecCGI FollowSymlinks Indexes
</Directory>
<Files ~ (\.php)>
AddHandler fcgid-script .php
FCGIWrapper /usr/lib/cgi-bin/php5 .php
Options ExecCGI
allow from all
</Files>
And that's all. Obviously, ensure that the user, group and permissions for the files are the correct one (www-data for user and group and 644 & 755 for files and folders).
My failure was not to add the <Files></Files>
tag. After adding it I finally could access the site. Before having the php configuration under the <Files>
tag I was adding those lines in the virtual-host, under the <Directory>
tag of my host. Like this:
<Directory /var/www/website/>
AddHandler fcgid-script .php
FCGIWrapper /usr/lib/cgi-bin/php5 .php
Options ExecCGI Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
But this wasn't working! In my virtual machine I have exactly this lines and it works perfectly... so, maybe my solution works for you too.
I hope this will help somebody :)
Edit: This is the forum thread that saved my life: http://forum.parallels.com/showthread.php?t=85413