Configuring OS X for Web Development

Started by sukishan, Aug 23, 2009, 12:45 AM

previous topic - next topic
Go Down

sukishan

Configuring OS X for Web Development
Perl
To begin adding dynamics to your local Website(s), one of the primary tools you might use is Perl. This is included in the standard OS X install and requires only a few short steps to enable cgi scripts to run on your localhost.

In the /Library/WebServer/CGI-Executables/ directory, you'll find some included test scripts. By default, an alias to this directory can be found in Apache's httpd.conf file as cgi-bin. To enable scripts to also be available to individual users on the system, you will need to also find and uncomment the following line in httpd.conf:

# AddHandler cgi-script .cgi

Note that you can also add an additional line as that shown above, but with a .pl extension, to support using .pl files with, or in place of, the .cgi extension.

As a security warning, I should mention that this does allow cgi to be executed anywhere Apache serves documents. This may not be an issue for localhost testing, but carefully think out your security strategy if you will be enabling Internet access to any of these local sites on your system.

To test your CGI capability, load one of the test scripts in your browser, i.e. http://127.0.0.1/cgi-bin/test-cgi (provided by Apple in the CGI-Executables directory). If you receive a forbidden error, it is due to permissions not being set. All CGI scripts need execution rights, the most common being 755. This can be done by using the Terminal to the location of the CGI script and running CHMOD 755 filename.cgi, or in this case, test-cgi. In this case we will open the Terminal and issue the following commands:

CD /Library/WebServer/CGI-Executables
sudo chmod 755 test-cgi

Once you have successfully executed a test script, you can either place Perl scripts in the CGI executables directory (remember to set your permissions), or, if you have enabled scripts to be run in the Users/shortname/Sites folders, you can place them there.
A good beginning makes a good ending

Don Bonomini

These problems are too esoteric, I would like to study slowly  :educated :educated

Go Up
 

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.
Name:
Email:
Verification:
Please leave this box empty:

Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:

shortcuts: alt+s submit/post or alt+p preview
IT Acumens | GinGly :: SMS Backup | Acumen :: Discussion Board | AshokPillar :: Hosting | CineBuzz :: Latest Cinema News | My Kids Diary :: Capture your kids magical moment
Copyright 2005 - 2017 :: IT Acumens :: All Rights Reserved.
ITAcumens Forum with 2 lakhs post running for 10 years - Powered by HostGator Dedicated Server