1. Log in to the server as root or sudo to root in the terminal if you prefer to use a command line editor.
2. Using TextEdit (or terminal based text editor such as vi) open /etc/httpd/httpd.conf
Note: You can return to the original httpd.conf file if necessary by duplicating and renaming either the httpd.default or httpd.bak file located in the same directory.
3. Edit the line that reads
"AllowOverride None"
to read
"AllowOverride Options"
This line is about 1/4 of the way through the document. See Figure 1 below for a sample. Save the changes.
Figure 1 Editing httpd.conf file
4. Create a new file in the text editor.
Type: Options +ExecCGI
Save the file in the top level of the user's Sites folder.
Name the file:
.htaccess
(You must include the period as the first part of the file name.) The relative pathname should be: user/Sites/.htaccess
5. Copy and rename the test-cgi file from
/Library/WebServer/CGI-Executables/
to
/Users/user/Sites/test-cgi.cgi
Note: In order for CGI scripts outside of the CGI-Executables directory to run, they need to have the .cgi filename extension. The test-cgi provided does not have the execute bit set. You will also need to set the execute bit for the script to actually run. See technical document 106519 "
Mac OS X: How to Troubleshoot Errors When Running CGIs" for additional information.
6. Test the script by pointing a browser to
http://server.name.com/~user/test-cgi.cgi
This document is intended to supplement the Server Admin Guide. Please direct all questions regarding this article to the developer site at
http://developer.apple.com or the discussion boards.
Apple, Inc. intends for the information contained in this article to be accurate and reliable, however, it is provided "AS IS." APPLE EXPRESSLY DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, AS TO ANY MATTER WHATSOEVER RELATING TO THE INFORMATION PROVIDED, INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT.