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

djsmiley2k

Well-known member
Joined
Jul 10, 2016
Messages
120
Best answers
0
Ratings
5
Points
18
#1
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
Joined
Jun 22, 2017
Messages
202
Best answers
0
Ratings
73 1
Points
28
#2
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
Joined
Jul 10, 2016
Messages
120
Best answers
0
Ratings
5
Points
18
#4
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
Joined
Jun 22, 2017
Messages
202
Best answers
0
Ratings
73 1
Points
28
#7
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"
 
Joined
May 9, 2018
Messages
17
Best answers
0
Ratings
13 6
Points
3
#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
Joined
Jul 10, 2016
Messages
120
Best answers
0
Ratings
5
Points
18
#5
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?
 
Joined
May 9, 2018
Messages
17
Best answers
0
Ratings
13 6
Points
3
#6
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
131
Replies
5
Views
224
Replies
11
Views
349
Newer Threads
Replies
2
Views
75
Replies
10
Views
117
Replies
8
Views
95
Latest Threads
Replies
7
Views
33
Replies
2
Views
31
Replies
2
Views
29
Replies
25
Views
123
Recommended Threads
Similar Threads
Replies
1
Views
1,292
Replies
3
Views
1,256
Replies
9
Views
7,906
Replies
2
Views
1,487

Latest postsNew threads

Latest Hosting OffersNew Reviews

Sponsors

Latest Blog ArticlesMost Viewed Threads

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