| July 06, 2008 |
|
Site
Index |
|
The cgi/perl feature allows you to run any cgi script from a directory located inside your home directory, provided the script confirms to the terms and conditions of our usage agreement. The 'cgi-bin' directory allows you to execute a CGI script written in PERL, UNIX or C shell. PERL and shell programs are self-compiling and can be utilized immediately after transfer. Uploading Scripts To upload a script, login to your virtual server using FTP. Once logged in go to the directory where you want to upoload your cgi script to, this is usually /home/. Make sure that your FTP client is set to ASCII mode (if you upload in binary mode then your script will not work), upload your cgi script ensuring that it has a .cgi or .pl extension.
To make a script work then you must make the script executable, you do this by setting the permissions on the script. A cgi script should be given the following permissions:- chmod 700 or owner=read/write/execute, group=nothing, world=nothing To do this most clients have a command to CHMOD.. ie. in WS_FTP you can right mouse click on a filename and there is a CHMOD command available. Setting Paths and Variables Variables and paths are the parts of the script that you must configure so that the script knows where data and programs can be found. Absolute and URLs will most likely be used in cgi scripts and if so you need to know where they are. The main paths are as follows: PERL - /usr/bin/perl PERL 5 - /usr/bin/perl Sendmail - /usr/sbin/sendmail Date - /bin/date Web/home directory/path - /home/sites/www.yourdomain.co.uk/web The first line of all PERL scripts must therefore be : #!usr/bin/perl An absolute path is a path to a certain file or directory on the server. For example you might want to set a variable ($links) to the absolute path to your links.pl file. When configured properly the link should look like: $links="/home/www.yourdomain.co.uk/web/links.pl"; The script may also ask for the URL to this file (links.pl). If the variable were $links then set it as follows: $linksurl="http://www.yourdomain.co.uk/links.pl"; Scripts obtained from free archives will almost always require the variables to be defined as we have done above. This is the most common source of problems with scripts not working properly so make sure your variables are set correctly. Testing Scripts To test your script you must execute it on the server which means your permissions must allow the user to execute the script, otherwise a permission denied error will occur. Useful Links The best place to find free cgi-scripts and to lean more about PERL are at www.cgi-resources.com, www.perl.org and www.perl.com. Grade1 cannot provide support for scripts that do not work, instead you should contact the author of the script for support. We do offer script programming at £25 / hour and are able to develop programs to suit your needs. Please contact us for further information about this service. |
|
|
© Grade1 Internet Solutions PO Box 175, Waterlooville. PO8 8YR. Tel/Fax: (023) 9243-1759 [Terms & Conditions] [Privacy Statement] |
|||