cgi-bin folder - Should I delete it my public_html?

djsmiley2k

Well-known member
Registered
Joined
Jul 10, 2016
Messages
198
Points
18
After using WHM, I created a new account for a website but when I enter the public_html, I see a cgi-bin folder, I do't know why it was there and it use for what? Should I delete it my public_html? if deleted, I can re-create it without any issues?
 

mobin

Well-known member
Registered
Joined
Jun 22, 2017
Messages
234
Points
28
Yes, you can delete if you don't have CGI scripts to run from your application [ which you normally put into the cgi-bin directory and execute ]. Later you can recreate the directory anytime without any issues.
 

djsmiley2k

Well-known member
Registered
Joined
Jul 10, 2016
Messages
198
Points
18
djsmiley2k
Yes, you can delete if you don't have CGI scripts to run from your application
I got your point, just not sure which is a CGI script because I never have seen it before.
 

mobin

Well-known member
Registered
Joined
Jun 22, 2017
Messages
234
Points
28
mobin
As said, thats purely based on what you have on the server. If you would like to disable it for new accounts

You can browse to "WHM Home » Server Configuration » Basic cPanel & WHM Setup" and set the following option to "No":

Automatically create a cgi-bin script alias. This setting can be individually overridden during account creation.

Also, as far as CGI access, you can disable the following options for your packages via "WHM >> Packages >> Edit a Package":

"CGI Access"
 

BenZ-AMS

Member
Registered
Joined
May 9, 2018
Messages
22
Points
3
I've often wondered about this.

The cgi-bin directory seems to be a relic of a long ago era.

Before mod_cgi was created and commonly used in Apache, the cgi-bin directory was necessary to execute CGI based scripts.

But now with mod_cgi and the cgi-script handler, any file with a .pl or .cgi (common CGI file extensions, others can be defined) can be executed in any directory (assuming ExecCGI is enabled, which is also common).

You could effectively remove the treatment of the cgi-bin as a ScriptAlias directory and just leave it as a normal directory as long as you have mod_cgi with the cgi-script handler and ExecCGI enabled.

But this also leads to a bigger question. How many people actually still use CGI scripts? Most everything is PHP nowadays.
 

djsmiley2k

Well-known member
Registered
Joined
Jul 10, 2016
Messages
198
Points
18
djsmiley2k
You could effectively remove the treatment of the cgi-bin as a ScriptAlias directory and just leave it as a normal directory as long as you have mod_cgi with the cgi-script handler and ExecCGI enabled.
I feel reliable when reading your advice and know it is safe to remove that folder. A strange thing is, sometimes when I enter cgi-bin folder I saw one or two files in it or it is just a blank folder. In the case it has some files there, it is safe to remove folder?
 

BenZ-AMS

Member
Registered
Joined
May 9, 2018
Messages
22
Points
3
BenZ-AMS
Well, it depends on what those files are and if you are using those files/scripts. Unfortunately, I nor anybody else here will likely be able to answer that question for you.

But if you delete the cgi-bin directory, any files or sub directories under the cgi-bin directory will also be removed.

I was talking mainly about removing the ScriptAlias stipulation in the Apache configuration. That's the configuration directive that makes the cgi-bin directory a "special" directory. Apache might bark at you if you delete the cgi-bin directory and then try to restart Apache, because it won't be able to find that directory.
 
Older Threads
Replies
5
Views
3,145
Replies
5
Views
10,183
Replies
11
Views
8,030
Newer Threads
Replies
2
Views
1,608
Replies
0
Views
1,646
Replies
10
Views
2,736
Replies
8
Views
2,235
Latest Threads
Replies
0
Views
123
Replies
1
Views
79
Similar Threads
Replies
1
Views
2,740
Replies
3
Views
3,693
Replies
11
Views
75,248

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top