tags:

views:

117

answers:

2

It gives me the following message:

The requested URL /cgi-sys/php-cgiwrap/gcadmin/php5.cgi/projects/globalcolleage/index.php was not found on this server.

Any suggestions?

(I'm using WAMP)

I think it has something to do with this hthaccess file:

IndexIgnore *
DirectoryIndex index.html index.HTML index.shtml index.cgi index.php index.php3 index.phtml index.htm home.html welcome.html
Action application/x-pair-sphp5 /cgi-sys/php-cgiwrap/gcadmin/php5.cgi
AddType application/x-pair-sphp5 .php

(the file exist: D:\wamp\www\projects\globalcolleage\index.php)
A: 

Firstly, are you sure that file exists? Double check.

Secondly, open up .htaccess and type this

DirectoryIndex index.html index.php

This tells Apache to first look for index.html, and if not found, then look for index.php.

alex
That's assuming that he's doing something like mysite.com/ rather than mysite.com/index.php which may be correct, but not specifically stated in OP question
jaywon
@jaywon I just deleted the htaccess file and it worked. Should I leave it like this?
janoChen
+3  A: 

"Not found on this server" normally indicates that you've got an error in your url. Apache isn't finding the requested file. Check your url for typos and check your filename.

Next try a php file which is not an index to see if that works. If normal files work but directory indexes don't, then check your httpd.conf for a line like this:

DirectoryIndex index.html index.php

This tells apache to use index.php for directory index if index.html isn't found.

My bet is a typo in the url since you're getting a file not found error.

Edit:

Since removing the .htaccess file resolved the problem, my guess is that the Action directive was not set up correctly.

http://httpd.apache.org/docs/2.0/mod/mod_actions.html

The Action directive sets a program to handle requests for a particular file type. This is not needed with php in an out-of-the-box setup. You can use php as a cgi binary this way, but it's more complicated than using the apache module.

Mnebuerquo
@Mnebuerquo its weird but when I delete the htaccess file it works.
janoChen
Weird. It didn't give me the banner for new answers while I was writing. Now it looks like I didn't read before responding.
Mnebuerquo
@janoChen : Should probably post the contents of the .htaccess and httpd.conf in the question too. That would make it easier.
Mnebuerquo
@Mnebuerquo I did post the .htaccess file (there isn't any httpd.conf though).
janoChen
@janoChen : Apache has a main configuration file which will contain the default directives for all directories. The .htaccess just overrides those defaults. I'm not sure where it would be on your system, but it's likely in the Apache program directory on windows.
Mnebuerquo
@Mnebuerquo when I delete the htaccess everything works OK. It is safe to leave it like that? (I think my server do detect index.php by default.)
janoChen
I think apache/php installations normally default to recognizing both index.php and index.html. The Action and AddType are used to set special handling for files or file types. Normally you don't need to do this with php as the .php file type and handler is set in the main apache conf. If you want to exercise more control over how php runs then you might need these directives. I would put them in the main conf file instead of .htaccess though.
Mnebuerquo
You can also google any apache directive and find lots of info. I use "apache xxxx directive" as my search string where xxxx is the thing you're seeing in the configuration such as AddType. The online manual at apache.org tends to be the first hit.
Mnebuerquo