1. Knowledge Base
  2. >
  3. Results
  4. >
  5. What is cgi-bin?

What is cgi-bin?

To learn what cgi-bin is, we first need to understand what CGI means. The CGI or Common Gateway Interface is the process for scripts to communicate with your hosting server. The folder for CGI scripts is what we call the cgi-bin. It is created in the directory root of your website and where your scripts are permitted to run or execute. For these scripts to run, the permission of the cgi-bin folder should be set to 0755.

What Does CGI Do and Why Does It Matter?

Technically, CGI improves the visualization of your website. This is especially useful for e-commerce websites in which CGI provides visitors with great visual content to help them understand what the product is and then ultimately become one of your customers. CGI is used extensively nowadays for marketing, virtual reality, architecture, and even artistic purposes. You can now imagine how useful and advantageous CGI is for a simple website to achieve that “3D look” or realistic effect to online visitors.

How Do You Run Your Own CGI Scripts?

You can create your own CGI scripts and store them in your cgi-bin, and then run or access these scripts through your browser by calling them through their URL. These scripts usually have the .pl or .py file extensions (from the Perl and Python programming languages). Please make sure to set the permission of your cgi-bin folder to 0755 to make the scripts executable.



To troubleshoot your CGI scripts, please refer to this article, CGI Troubleshooting.

Where Do You Find the cgi-bin?

The cgi-bin is found in the directory root of your website inside your server.

cPanel - File Manager - Directory Root for cgi-bin

Can You Delete cgi-bin?

The cgi-bin is located in the directory root of your website. If there are no scripts stored in that folder, then yes, you can delete that folder. It should not be a problem with your website. However, if there are scripts in it and you are not sure if those are essential to your website, then it is best to leave it there.

In case you deleted this folder and later found out that your website does need the scripts, you can still recreate the cgi-bin folder inside the directory root and save your CGI scripts in there again.

What Is the Difference Between CGI and Perl?

The CGI scripts or applications are written using different programming languages. Perl is only one of them (with .pl extension). Other common programming languages used are C and Python. This should be applicable in all of our hosting environments.

How Do You Enable CGI Outside of the cgi-bin?

By default, this feature should be enabled in your hosting server. However, if you are unable to run CGI scripts out of your cgi-bin folder, you can try enabling CGI through your .htaccess. You can use the following codes in your .htaccess file.

AddHandler cgi-script .cgi .pl
Options +ExecCGI