You don’t have permission to access /php/php-cgi.exe/index.php on this server. PHP 5 on Apache 2.2

Did you get this on your fresh install of PHP5 on Windows?

Forbidden
You don’t have permission to access /php/php-cgi.exe/index.php on this server.

You might encounter this with a default installation of Apache 2.2 (I used the exe installer) and a manual install of PHP5 as cgi on Windows. I placed this in my httpd.conf and followed other steps according to the PHP5 on Apache 2.2 instructions by using in httpd.conf:

#load php5 as cgi
ScriptAlias /php/ “c:/php/”
AddType application/x-httpd-php .php
Action application/x-httpd-php “/php/php-cgi.exe”

In order to fix the forbidden error I had to change this line:

<Directory “C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/”>
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>

to this:

<Directory “c:/php”>
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>

EDIT: Looking back now, I see this solution at the bottom of the comments from 2006 on the Apache instructions. I probably didn’t find it because this error wasn’t mentioned. I had a feeling that replacing the line probably wasn’t a good thing and that you should add it additionally. That’s what the comment says so I also suggest that approach.

7 thoughts on “You don’t have permission to access /php/php-cgi.exe/index.php on this server. PHP 5 on Apache 2.2”

  1. Error You don’t have permission to access /php/php-cgi.exe/Test/Index.php on this server.
    Why is this error ?
    Apache is running, but PHP is error.
    Help me.

  2. Hi, I’ve changed that in httpd.conf but it still doesn’t work, it says me I have no permission to access /php/php-cgi.exe/page.php. Where do I need to put that options in the httpd.conf file? May I’m missing something else.

Comments are closed.