Portal Home > Knowledgebase > Articles Database > cgi execution problem ( not found for every file inside cgi-bin directories )


cgi execution problem ( not found for every file inside cgi-bin directories )




Posted by FarzinSB, 05-19-2011, 06:16 AM
hi , i faced a problem regarding cgi execution in my server . one of my customers wanted to use cgi in his host , but server returns , i have checked everything i knew , even reinstalled apache with cgi again with fresh httpd configuration , but still the same problem exists. even i have changed php/suexec configuration , and set php to run in DSO , fcgi , cgi modes but it gives the same error. my apache 2.2 is running in SUphp mode and suexec is active too. i have pre user configuration file in following location /usr/local/apache/conf/userdata/std/2/{userhostname}/Username.conf i have seen in httpd.conf the following line : which i removed it and now i have : but no changes in the result . still every file i place in cgi-bin folder of the users do no run. what else should can i do ? i should mention that , for that user , cgi execution is activated from whm > edit packages . also cgi execution is active from whm Main >> Service Configuration >> Apache Configuration >> Global Configuration ExecCGI also i think that cpanel cgi files are running with out any problems and every thing is working fine in cpanel. any helps would be appreciated. also i have tested cpanel sample cgi scripts , they worked in cpanel page but those which linked directly didnt work too. i just dont know how should those cgi files be linked directly. for example this worked : /frontend/x3/cgi/Countdown/index.html but these didnt work http://domain.com/cgi-bin/entropybanner.cgi http://domain/cgi-bin/cgiemail i even tried htaccess codes of SetHandler cgi-script , but no result.

Posted by pagebuzz, 05-19-2011, 07:46 AM
Your error is not because of the program not executing. It is becuase your URL does not exist and additionally you have a bad 404 error document in the apache config file. Check your url, make sure the path is correct and if it is case sensitive. You will getthe same error by typing in any page that does not exist on your website. More than likely, the 404 error document in your apache config is also defined as a file that is not on your website. If you need some cgi resources, check out http://bumblebeeware.com

Posted by FarzinSB, 05-19-2011, 08:23 AM
hi , pagebuzz , thanks for your attention , but no , the files are there , in /home/userdir/public_html/cgi-bin/filename.cgi but when i addressed it directly apache returned 404 not found .! cpanel support fixed my problem . here is what he told me about the problem : this was primarily the result of the following option being set to "NO" in "WHM >> Server Configuration >> Basic cPanel & WHM Setup": "Automatically create a cgi-bin script alias. This setting can be individually overridden during account creation." ScriptAlias is not necessary for CGI capabilities; however it does instruct Apache to treat files in the specified directory as CGI programs. and also , there was a .htaccess code in the root of the host which caused conflict for apache , and by removing that line every thing is working fine now .

Posted by Jedito, 05-19-2011, 09:34 AM
What do you get at your error logs?

Posted by FarzinSB, 05-19-2011, 10:08 AM
for example this is one of the error lines in apache error_log : script not found or unable to stat: /usr/local/apache/cgi-bin/mt

Posted by Jedito, 05-19-2011, 10:34 AM
Modify Account" on WHM, and check if CGI is enabled for that account. It's going to be easier than manually modify httpd.conf.

Posted by FarzinSB, 05-19-2011, 10:53 AM
i had done that via whm , i activated cgi access for those hosts via whm , but when i wanted to execute a cgi script it gave me not found. and the reason was that no scriptalias was defined in httpd.conf , and activating its option via whm solved my problem. thanks in advanced



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
DKIM Verification (Views: 561)