Get 69% Off on Cloud Hosting : Claim Your Offer Now!
When CGI (Common Gateway Interface) scripts aren't operating in Plesk, several factors might be inflicting the issue, ranging from configuration problems to permission settings. Below is an in depth manual to help you troubleshoot and resolve issues with CGI scripts in Plesk:
Log in to Plesk: Access your Plesk control panel using your credentials.
Navigate to Hosting Settings:
Go to Websites & Domains.
Click on the domain where you're trying to run the CGI script.
Click on Hosting Settings.
Check CGI Support:
Ensure that the "CGI support" checkbox is checked. If it isn't, check it and save the settings.
If you had to enable it, try running your CGI script again after the change.
Access File Manager:
In Plesk, go to Websites & Domains > File Manager.
Locate Your CGI Script:
Navigate to the cgi-bin directory where your CGI scripts are stored.
Set Correct Permissions:
Right-click on the script file and select Change Permissions (or use the "Permissions" link in the File Manager).
Ensure the script has the correct permissions:
File permissions: Generally, the permissions should be set to 0755 (rwxr-xr-x) to allow the script to be executed.
Owner permissions: Make sure the script is owned by the correct user, usually the one associated with the domain.
Edit the Script:
Open the script in a text editor through the File Manager.
Check the Shebang Line:
The first line of your CGI script should indicate the correct path to the interpreter (e.g., #!/usr/bin/perl for Perl scripts).
You can verify the interpreter path by checking with your hosting provider or using SSH to locate the path (which perl or which python).
Correct Directory Location:
Make sure that your CGI scripts are placed in the cgi-bin directory of your website. Plesk expects CGI scripts to reside here.
Directory Permissions:
Ensure the cgi-bin directory itself has the correct permissions, typically set to 0755.
Review the Code:
Open the script and carefully review the code for any syntax errors or typos.
Run in a Terminal (Optional):
If possible, run the script from a terminal to check for syntax errors before executing it in the web environment.
Access Error Logs:
In Plesk, go to Websites & Domains > Logs.
Check for Specific Errors:
Look for any error messages related to CGI scripts. Common errors might include "500 Internal Server Error," which could indicate a problem with the script or its permissions.
Debugging Information:
Use the error log information to diagnose what might be going wrong with the script.
Open the .htaccess File:
If your domain uses a .htaccess file, open it from the File Manager.
Verify CGI Settings:
Ensure that the .htaccess file doesn’t contain directives that prevent the execution of CGI scripts. If you're not sure, temporarily rename the .htaccess file to see if the script works without it.
Add the Right Directives:
You might need to add the following line to the .htaccess file:
apache
Copy code
Options +ExecCGI
AddHandler cgi-script .cgi .pl
This allows CGI scripts to run in directories other than cgi-bin.
Review Script Execution Time:
If the script is long-running, it might be timing out. Check with your cloud hosting provider about script execution limits and see if they can be extended.
Check Interpreter Versions:
Ensure that the CGI script is compatible with the version of Perl, Python, or another language installed on the server.
Update Scripts:
If the server environment has been updated, you may need to update your script to be compatible with the new environment.
Seek Professional Help:
If you’ve tried all of the above steps and your CGI scripts still aren’t working, contact your hosting provider’s support team. Provide them with details about the issue, including any error messages you’ve encountered.
Let’s talk about the future, and make it happen!
By continuing to use and navigate this website, you are agreeing to the use of cookies.
Find out more