Darrell Schauss

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.


Categorised as: php, Software


7 Comments

  1. [...] Making phpUnderControl (CruiseControl) accessible via a Proxy Saved by mathewi on Thu 18-12-2008 PHP 5 on Apache 2.2 You don’t have permission to access /php/php … Saved by Thupore on Thu 18-12-2008 JSP files not being parsed Mod_JK and Apache http Saved by [...]

  2. Denis says:

    Thanks!!! I couldn’t find it elsewhere!

  3. Yap, IT Works Now. Thanks a Lot.

  4. Petter says:

    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.

  5. drale says:

    You need to give permission to access the php install directory by editing the httpd.conf

  6. George says:

    Thanks it works!!!!

  7. Juan says:

    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.