Running the Scripts in This Chapter


To run any of the CGI shell scripts presented in this chapter, you'll need to do a bit more than just name the script appropriately and save it. You must also place the script in the proper location, as determined by the configuration of the web server running on your system.

Unless you've specifically configured your web browser to run .sh scripts as CGI programs, you'll want all of the scripts in this chapter to have a .cgi filename suffix. You should save the .cgi files either in the desired directory on your web server or in its /cgi-bin/ directory, again depending on the configuration. It is important to note that the .cgi file-naming conventions in this chapter assume that you are saving those files in your web server's root directory. If you are instead saving them in its /cgi-bin/ directory, you must add /cgi-bin/ to all of the script paths in this chapter. For example, script-name.cgi becomes /cgi-bin/ script-name.cgi . Finally, you'll need to ensure that each .cgi script is readable and executable by everyone, because on most web servers your web queries run as user nobody or similar.

Of course, you need a web server running to have any of these scripts work properly. Fortunately, just about every cool modern OS includes either Apache or something similar, so getting a server up and running should be straightforward. You will need to ensure that the script directory on your web server has CGI execution permission in the server configuration file. In Apache, for example, the directory needs to have Option ExecCGI specified in the httpd.conf file for the scripts to work. Then ensure that the directory is globally readable and executable.

Of course, the alternative is to experiment with these scripts on a web server that is not on your machine but that is already ” hopefully ” set up properly. Talk with your web hosting provider; you'll need access to a web server that not only allows you to execute your own CGI scripts but also allows you to telnet or (preferably) ssh into the server to tweak the scripts. Most hosting companies do not allow this access, due to security concerns, but you can find a bunch of possibilities by searching Google for "web hosting ssh telnet access."




Wicked Cool Shell Scripts. 101 Scripts for Linux, Mac OS X, and Unix Systems
Wicked Cool Shell Scripts
ISBN: 1593270127
EAN: 2147483647
Year: 2004
Pages: 150
Authors: Dave Taylor

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net