jating1
asked on
Apache error 500 occurs for cgi script
Hi,
I think I have a problem with running .cgi scripts with Apache. I am fairly new to apache, and do not fully understand the right way to edit the config/htaccess files to get what I want (I have searched for it, and on this site, and I dont get where/how you edit the files)
my xampp installed apache path is: C:\xampp
my document root is: C:\xampp\htdocs
i want a script within C:\xampp\htdocs\01 to be able to execute
in the readme it says i have to set the cgi file permissions to 755, i think i have to put the chmod keyword in a config file, but im not sure where.
Also i think i have to say that i want that folder to be able to run cgi scripts, I have looked at
http://httpd.apache.org/docs/2.0/howto/public_html.html and http://httpd.apache.org/docs/2.0/howto/htaccess.html
which mention that I have to have:
Options ExecCGI
SetHandler cgi-script
within a directory tag ? I think this is within the config file C:\xampp\apache\conf\httpd .conf but im not sure.
I tried to change this config file, and the error message I get is:
"Server error!
The server encountered an internal error and was unable to complete your request.
Error message:
couldn't create child process: 720003: nph-proxy-1.cgi
If you think this is a server error, please contact the webmaster.
Error 500"
I think that might be because i need to set the file permissions somehow to 755 on my localhost (windows xp)
I think I have a problem with running .cgi scripts with Apache. I am fairly new to apache, and do not fully understand the right way to edit the config/htaccess files to get what I want (I have searched for it, and on this site, and I dont get where/how you edit the files)
my xampp installed apache path is: C:\xampp
my document root is: C:\xampp\htdocs
i want a script within C:\xampp\htdocs\01 to be able to execute
in the readme it says i have to set the cgi file permissions to 755, i think i have to put the chmod keyword in a config file, but im not sure where.
Also i think i have to say that i want that folder to be able to run cgi scripts, I have looked at
http://httpd.apache.org/docs/2.0/howto/public_html.html and http://httpd.apache.org/docs/2.0/howto/htaccess.html
which mention that I have to have:
Options ExecCGI
SetHandler cgi-script
within a directory tag ? I think this is within the config file C:\xampp\apache\conf\httpd
I tried to change this config file, and the error message I get is:
"Server error!
The server encountered an internal error and was unable to complete your request.
Error message:
couldn't create child process: 720003: nph-proxy-1.cgi
If you think this is a server error, please contact the webmaster.
Error 500"
I think that might be because i need to set the file permissions somehow to 755 on my localhost (windows xp)
ASKER
Thanks for the response,
I understand what you want me to do, but I have windows XP Home (i dont have a file permissions/security tab) and so i dont think i can set these settings.
As I understand, I dont think the script will execute without the right permissions (which obvioulsy I cannot set), so is there a way of editing any files in order to bypass this security or anything ?
Also, you know where you say
"The c:/some/directory/here will be the actual directory name, C:\xampp\htdocs\01 in your case.
For the ... part, this is where you put these lines:
Options ExecCGI
SetHandler cgi-script"
do u mean to put them lines in the main httpd.conf file or a .htaccess file in that directory ?
Thanks
Jatin
I understand what you want me to do, but I have windows XP Home (i dont have a file permissions/security tab) and so i dont think i can set these settings.
As I understand, I dont think the script will execute without the right permissions (which obvioulsy I cannot set), so is there a way of editing any files in order to bypass this security or anything ?
Also, you know where you say
"The c:/some/directory/here will be the actual directory name, C:\xampp\htdocs\01 in your case.
For the ... part, this is where you put these lines:
Options ExecCGI
SetHandler cgi-script"
do u mean to put them lines in the main httpd.conf file or a .htaccess file in that directory ?
Thanks
Jatin
For XP Home, I'm guessing the default is to allow execute, so you don't need to do anything. If we get everything else working, but it still won't execute, then you might need to post a question in the XP Home zone for specific help on that.
You can put those options in either an httpd.conf or a .htaccess, as long as you have an AllowOverride directive allowing it. From the apache documentation:
"In general, you should never use .htaccess files unless you don't have access to the main server configuration file."
http://httpd.apache.org/docs/2.0/howto/htaccess.html
So, if you have access to the httpd.conf (which it sounds like you do), put your configurations there, and don't use .htaccess files.
You can put those options in either an httpd.conf or a .htaccess, as long as you have an AllowOverride directive allowing it. From the apache documentation:
"In general, you should never use .htaccess files unless you don't have access to the main server configuration file."
http://httpd.apache.org/docs/2.0/howto/htaccess.html
So, if you have access to the httpd.conf (which it sounds like you do), put your configurations there, and don't use .htaccess files.
Check the shebang line of your script if it points to ... I guess you're using perl ... perl interpreter.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Then in your httpd.conf, you should have a directory section that starts with
<Directory c:/some/directory/here>
...
</Directory>
The c:/some/directory/here will be the actual directory name, C:\xampp\htdocs\01 in your case.
For the ... part, this is where you put these lines:
Options ExecCGI
SetHandler cgi-script
Then you should have an error log. Whenever there is an error more details about the error will go in the log. Look for a line in your httpd.conf that says
ErrorLog c:/some/path/and/filename.
The part after the ErrorLog is the name of your error log file. Look in that file to find the details of the error.