Tell me more ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have logged in just now so I couldn't edit the previous question I have asked, Sorry :) my last question is http://serverfault.com/questions/280633/the-requested-url-php-php-cgi-exe-a-php-was-not-found-on-this-server

I have installed on Windows7 apache2.2 and php5.3 when I am trying to execute the *.php file I am getting an error:

404 Not Found "The requested URL /PHP/php-cgi.exe/a.php was not found on this server"

This is my httpd configuration file From httpd.conf:

ScriptAlias /cgi-bin/ "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/cgi-bin/"
ScriptAlias /php/ "C:/PHP/"
AddType application/x-httpd-php .php
Action application/x-httpd-php "C:/PHP/php-cgi.exe"
DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs"

I can execute perl scripts that resides in C:/Program Files (x86)/Apache Software Foundation/Apache2.2/cgi-bin/ however execution of php scripts results with an error:

The requested URL /PHP/php-cgi.exe/a.php was not found on this server.

share|improve this question
Please show (edit your question) how you've configured Apache to handle *.php files? – LazyOne Jun 15 '11 at 11:54
Please post in meta.serverfault.com asking for your accounts to be merged, then edit that question. – MikeyB Oct 5 '11 at 17:14

1 Answer

What URL are you trying to access? If it really does contain php-cgi.exe it's more likely than not the wrong one, as that is the CGI handler. The right way to set up CGI would be to add the handler and then specify that all .php requests are sent to it, and then access the .php file directly.

Are you aiming for CGI or FastCGI?

Something like this could work for FastCGI:

FastCgiServer C:/httpd/php-cgi.exe
AddHandler php-fastcgi .php
SetHandler fastcgi-script
Action php-fastcgi /cgi-bin/php
DirectoryIndex index.html index.shtml index.cgi index.php
AddType application/x-httpd-php .php

CGI is simpler, but much slower:

ScriptAlias /cgi-bin/ "C:/www/cgi-bin/"

<Directory "C:/www/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

All PHP scripts on C:\www\cgi-bin should then just work provided they have the right header (interpreter description or "shebang").

http://www.fastcgi.com/drupal/node/5?q=node/10

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.