What is the cgi-bin folder used for?

  • September 13, 2017
  • 0 Comments

CGI is the abbreviation for Common Gateway Interface. This common gateway interface makes it possible for scripts to communicate with the server. The cgi-bin is a folder automatically created for you where you can place those scripts. A good example of this is the FormMail script which you can use to create a contact form for your site.

Can I delete the cgi-bin?

If you are not storing any scripts in your cgi-bin, it shouldn't be a problem if you delete the folder, but it also doesn't hurt to just leave it in your account. Unless there are scripts stored in the folder, it isn't taking up any significant space. If you do delete the folder but find later on that you need the the cgi-bin for a script, simply recreate the folder and save your script in the cgi-bin.

Tips for Using the cgi-bin

  • Scripts that you store in the cgi-bin should have file permissions set to 755 in order to run properly. 
  • When adding the script tag to your site file(s) make sure you are using the full path to the script. For example:

    http://www.yourdomain.com/cgi-bin/yourscript.pl

How helpful was this article to you?