About scripting languages
About CGI/Perl etc
What information and server paths do I need?
Troubleshooting CGI scripts
What about PHP?
What is MySQL and how do I use it?
What are CGI scripts ?
CGI (Common Gateway Interface) is a process used by the server to pass information between the user and an application on the server. With CGI access, you can install Perl scripts on your website for such things as feedback forms, guestbooks, counters, and so on.
What information and server paths do I need?
CGI scripts must be run from the cgi-bin directory which is outside the httpdocs directory. CGI scripts need to have a .cgi or .pl extension. PHP scripts need to have a .php extension.
For security purposes, we use Apache's suEXEC for the execution of CGI scripts. If you do not understand the information below, you should seek professional assistance to set up your scripts.
cgi-bin absolute path = /var/www/vhosts/yourdomain.com/cgi-bin/yourscript.cgi (replace "yourdomain.com" with your actual domain name and "yourscript.cgi" with the actual script name).
cgi-bin relative path = /cgi-bin/yourscript.cgi
cgi url = http://www.yourdomain.com/cgi-bin/yourscript.cgi
public directory absolute path = /var/www/vhosts/yourdomain.com/httpdocs (replace "yourdomain.com" with your actual domain name).
path to Perl = /usr/bin/perl
path to Python = /usr/bin/python
path to Tcl = /usr/bin/tcl
path to sendmail = /usr/sbin/sendmail
path to the date program = /bin/date
If you upload files to a sub-directory, you would be able to view them by typing in http://www.yourdomain.com/sub-directory/filename.ext (again replace these with the relevant names).
PLEASE NOTE: We do not provide specific support for any scripting languages, including Perl. If you decide to use them, it is assumed that you know what you are doing and use them at your own risk. We do however offer full web design services, which includes installation and customisation of scripts where needed. We make sure that CGI is enabled for your site, Perl/Python/TCL is working properly on the server and give you the correct paths to Perl, Python, Sendmail, etc., but we will not debug any CGI scripts for our non web-design (hosting only) customers. The same is true for the troubleshooting of HTML, PHP, JavaScript, and so on.
Here are a few things to try when you are troubleshooting a CGI script:
1) First of all, thoroughly read through the instructions that came with the script and also check the website where the script was downloaded for troubleshooting info and user forums.
2) Make sure that you have uploaded your script to your cgi-bin which is outside your public httpdocs directory.
3) Check to see if the script was uploaded to the server in the proper format (usually ASCII not binary). If uploaded in the wrong format the script may appear to be in the right place but will not execute.
4) Make sure that there are not any DOS/Windows carriage returns (i.e. ^M) at the end of each line in the script. This is usually caused by a text editor or FTP program that is not properly uploading your script in a Unix/Linux format. If this is happening, try changing your code line break settings or upload settings to Unix/Linux.
Here's how this is done in Dreamweaver: From the menu, go to Edit > Preferences > Code Format, then change Line Breaks to "LF (Unix)".
5) Check the script to make sure the magic comment specifies where perl is located: #!/usr/bin/perl
6) Verify that all the paths are correct, including your public directory path. Do not use the "www" part of your domain in your public directory path. See our server paths section for more info.
7) Check to see if all the file permissions are set correctly. Permissions can be set using an FTP program that allows permissions to be set on transfer. Typically scripts are set to be 755, user: read, write, execute; group: read, execute; other: read, execute (-rwxr-xr-x), but you should always check your script instructions or README to be sure.
PLEASE NOTE: For security purposes, within the cgi-bin, script permissions cannot be set higher than 755, or user: read, write, execute; group: read, execute; other: read, execute (-rwxr-xr-x).
8) If you have checked all the above and are still receiving an "Internal Server Error" when trying to execute the script, this can occur when the script is uploaded or when the script is edited and saved in certain text editors. Usually the file is corrupted with the (line feed) hidden character which is commonly mistaken with the (carriage return).
9) Since installing a CGI script is extremely difficult for new webmasters, you may want to consider asking a friend with CGI (Perl, Python, etc.) experience to walk you through the process or hire a webmaster for this part of your site.
10) Here are a few good online articles on installing CGI scripts that might help, current at the time of writing:
Setting Up A Form Powered By CGI http://www.webmasterbase.com/article/348
How to install a basic Perl script on a Web server
http://serverwatch.internet.com/articles/perl101/
How To Install A Script
http://perl.about.com/library/weekly/aa072499.htm?once=true&
CGI Scripts for Fun and Profit http://hotwired.lycos.com/webmonkey/99/26/index4a.html?tw=programming
The Common Gateway Interface (NSCA)
http://hoohoo.ncsa.uiuc.edu/cgi/
Finally, if all else fails, you may want to consider using a PHP script.
What about PHP?
PHP is an open source, server-side, cross-platform, HTML embedded scripting language that is often used as a front-end for databases, such as MySQL. It is much easier to configure (no permissions to set, it can run from any directory, etc.) and much of what you can do with a CGI script you can do using PHP. The development community for PHP is gigantic, so there will be more and more applications that will be using it in the years to come. Our design team know PHP very well, and if you are finding that designing your own website and scripting is a little too hard for you, then don’t hesitate to contact our sales team to discuss the possible design of your site by our team of web developers.
PHP scripts need to have a .php. .php3 or .php4 extension.
We do not provide support for PHP debugging except as part of design work. For further information and PHP resources, try these places:
http://www.php.net/ (Official Site)
http://www.php.net/tut.php
http://www.hotscripts.com/PHP/
http://php.resourceindex.com/
http://www.phpbuilder.com/
What is MySQL and how do I use it?
MySQL is an open source, relational database management system often used in conjunction with scripting languages such as Perl, PHP, etc.
To create a MySQL database:
1) Log in to the control panel for your domain.
2) Click on DATABASES.
3) Click "Add New Database"
4) Enter the database name that you want to create. PLEASE NOTE: The username has to be unique on the server, so you might not always be able to use your first choice.
5) Click on OK.
6) Enter a username that you want to create to be used with the database.
7) Enter a password and confirm the password.
9) Click on OK
You can maintain your database(s) using phpMyAdmin, which is built into the Plesk control panel.
1) Log in to the control panel for your domain.
2) Click on DATABASES.
3) Select the database that you want to modify.
4) Click on DBWebAdmin.
For more information on using phpMyAdmin, please refer to phpMyAdmin's Configuration and FAQ pages at:
http://phpmyadmin.sourceforge.net/documentation/#config
For more information on MySQL, try these resources:
MySQL (official site)
http://www.mysql.com/
Beginning MySQL Tutorial (DevShed)
http://www.devshed.com/Server_Side/MySQL/Intro/page1.html
Website Database Basics With PHP and MySQL (DevShed)
http://www.devshed.com/Server_Side/PHP/DB_Basics/page1.html
Build your own Database Driven Website using PHP & MySQL (SitePoint)
http://www.webmasterbase.com/article.php?aid=228&pid=0
|