Friday, December 6, 2013

Apache CGI 101

Apache pre-installed on Mac OSX 10.7.5 and CGI is already configured in apache config file.
/private/etc/apache2/httpd.conf

Just place your cgi scripts under: /Library/WebServer/CGI-Excecutables

On your web browser, go to: http://localhost/cgi-bin/test.cgi *

Check apache log file: tail -f  /var/log/apache2/error_log

Start/stop/restart apache instance: sudo apachectl start/stop/restart


* Note: cgi-bin alias must be part of url, otherwise you will get error (files does not exist in the error log). This mistake is very common for beginners to overlook and caused a lot of headache! It took me hours and hours to realize this mistake. At first, I thought some wrong with apache config file and/or with cgi program.

---------------------------
If you want to test ssi exec cgi script in html for your website hosted by godaddy.com, it will not work due to security reason.

No comments:

Post a Comment