You can place CGI scripts in your public_html directory and execute them there. Make sure that the file and the parent directories have the correct permissions.
Place the CGI script
Place your CGI script at the desired location inside public_html.
Example:
public_html/cgi-bin/script.cgiDepending on the script, another file extension may also be used, for example .pl for Perl scripts.
Check permissions
For the script to be executed, the permissions must be set correctly. CGI scripts often require execute permissions.
Also check whether the first line of the script points to the correct interpreter.
Example for Perl:
#!/usr/bin/perlUse paths in Perl scripts
If your Perl script needs to access other files, use the full server path.
The format is:
/usr/www/users/FTP_LOGINNAME/PATH_TO_FILEReplace the placeholders with your own values:
| Placeholder | Meaning |
|---|---|
FTP_LOGINNAME |
Your FTP login name |
PATH_TO_FILE |
The path to the file inside your account |
Example:
/usr/www/users/example/public_html/data/config.txtDo not use relative paths if your script needs to find files reliably from different working directories.