In the most basic terms, 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 cgi-bin. It is created in the root directory of your web site and where your scripts can be run or executed. The cgi-bin folder will store the Perl-like scripts (.pl) that your web site will use. In order for these scripts to run, the permissions of the cgi-bin folder and the scripts it contains must be set to 0755.
What does CGI do and why is it important?
Technically, CGI enhances the display of your website. This is especially useful for e-commerce websites. CGI provides visitors with excellent visual content to help them understand what the product is and ultimately become one of your customers. CGI is widely used today for marketing, virtual reality, architecture and even artistic purposes. Now you can imagine how useful and advantageous CGI is for a simple website to achieve that 3D look or realistic effect on online visitors.
How do you run your CGI scripts?
You can create your CGI scripts and store them in your cgi-bin, and then run or access these scripts through your browser by calling them through your URL. These scripts usually have the file extensions .pl or .py (from the Perl and Python programming languages). Be sure to set the permission of your cgi-bin folder to 0755 to make the scripts executable.
Where do you find the cgi-bin?
The cgi-bin is located in the root directory of your web site within your server

Can you remove cgi-bin?
The cgi-bin is located in the root directory of your web site. 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 it contains scripts and you are not sure if they are essential for your website, it is better to leave them there.
In case you delete this folder and then discover that your website needs the scripts, you can still re-create the cgi-bin folder inside the root directory and save your CGI scripts there again.
What is the difference between CGI and Perl?
CGI scripts or applications are written using different programming languages. Perl is just one of them (.pl extension). Other common programming languages used are C and Python. This should be applicable in all our hosting environments.
How do I enable CGI outside of cgi-bin?
By default, this feature should be enabled on your hosting server. However, if you cannot run CGI scripts from your cgi-bin folder, you can try to enable CGI through your .htaccess. You can use the following codes in your .htaccess file.
AddHandler cgi-script .cgi .pl
Options +ExecCGI
