How to Upgrade Pip on Linux
Keeping Pip updated is crucial to guarantee you have access to the most recent Python…
By default, many web servers (like Apache) are configured to run CGI scripts only inside the cgi-bin directory. While this is a good security practice, sometimes developers may want to execute CGI scripts from other folders for flexibility and easier application structure.
This guide explains how to enable CGI execution outside the default cgi-bin directory using a simple .htaccess configuration.
CGI (Common Gateway Interface): A standard method that allows web servers to run external scripts (written in Perl, Python, etc.) and send dynamic content to users.
cgi-bin: The default directory where most servers store and execute CGI scripts.
By enabling CGI outside this directory, you can run scripts from custom folders useful for projects with unique directory structures.
1. Create or Edit the .htaccess File
In the folder where you want to allow CGI, create (or edit) a file named .htaccess.
2. Add CGI Handler and Execution Options
Insert the following lines into .htaccess:
AddHandler cgi-script .pl .cgi
Options +ExecCGI
AddHandler cgi-script .pl .cgi >> tells Apache to treat .pl and .cgi files as executable scripts.
Options +ExecCGI >> enables execution of CGI scripts within that folder.
3. Set File Permissions
Ensure your script files have execute permission:
chmod 755 script.cgi
chmod 755 script.pl
4. Restart Apache (If Needed)
If changes don’t take effect immediately, restart Apache:
systemctl restart httpd
Explore more hosting insights, tips and industry updates.
Keeping Pip updated is crucial to guarantee you have access to the most recent Python…
In this article, we will explain How to get the raw FTP log from the…
After installing an SSL certificate, you may not be able to browse your site. This…