How Can You Change The Hostname In cPanel Web Host?
In this post, we will show you how to change your cPanel web host’s hostname.…
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.
In this post, we will show you how to change your cPanel web host’s hostname.…
The 403 Forbidden Error in WordPress indicates that the server understands the request but refuses…
Softaculous is a lot like Fantastico in the fact that it is an “automated installer”.…