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
2,786
Replies
5
Views
9,508
Replies
11
Views
7,115
Newer Threads
Replies
2
Views
1,446
Replies
0
Views
1,487
Replies
10
Views
2,473
Replies
8
Views
2,070
Latest Threads
Similar Threads
Replies
1
Views
2,547
Replies
3
Views
3,462
Replies
11
Views
65,683

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