power_on

Member
Aug 10, 2004
8
0
151
Hello

I cant run cgi-bin scripts in the cgi-bin dir in the public_html

I've checked the suexec err log and it says

[2006-01-08 11:06:26]: info: (target/actual) uid: (hosting/hosting) gid: (hosting/hosting) cmd: staff.cgi
[2006-01-08 11:14:43]: info: (target/actual) uid: (hosting/hosting) gid: (hosting/hosting) cmd: staff.cgi
[2006-01-08 11:17:48]: info: (target/actual) uid: (hosting/hosting) gid: (hosting/hosting) cmd: staff.cgi


i think it is normal entries

I'VE CHECKED THE FILES PERMISSIONS and it is 755.
I've checked the virtual host entries and it is ok ,here it is:

<VirtualHost 98.55.145.66>
ServerAlias www.hostingarabs.com hostingarabs.com
ServerAdmin [email protected]
DocumentRoot /home/vhosts/hosting/public_html
BytesLog domlogs/hostingarabs.com-bytes_log
User hosting
Group hosting
<IfModule mod_php4.c>
php_admin_value open_basedir "/home/vhosts/hosting/:/usr/lib/php:/usr/local/lib/php:/tmp"
</IfModule>
<IfModule mod_php5.c>
php_admin_value open_basedir "/home/vhosts/hosting/:/usr/lib/php:/usr/local/lib/php:/tmp"
</IfModule>
ServerName www.hostingarabs.com
<IfModule mod_userdir.c>
Userdir disabled
Userdir enabled hosting
</IfModule>
User hosting
group hosting
CustomLog domlogs/hostingarabs.com combined
ScriptAlias /cgi-bin/ /home/vhosts/hosting/public_html/cgi-bin/
</VirtualHost>


I also have checked the cgi option in whm settings and it is "y".

Plz help me....

Any new Ideas.


Thank you and Best Regards...
 

AndyReed

Well-Known Member
PartnerNOC
May 29, 2004
2,217
4
193
Minneapolis, MN
power_on said:
I've checked the suexec err log and it says

[2006-01-08 11:06:26]: info: (target/actual) uid: (hosting/hosting) gid: (hosting/hosting) cmd: staff.cgi

I'VE CHECKED THE FILES PERMISSIONS and it is 755.
The error message is self explanatory, and it's telling you exactly what the problem is. Suexec will only run a script if all the security checks.Make sure the cgi/perl scripts are owned by the user's uid and gid (user and group).

It is very possible that the script is failing to run via the cgi interface, because the script is not owned by its user and group. The script would also fail without the proper header. Also, make sure the script is in the correct web root path.

There is a cPanel script you can run at the prompt: /scripts/fixsuexeccgiscripts
 

AndyReed

Well-Known Member
PartnerNOC
May 29, 2004
2,217
4
193
Minneapolis, MN
power_on said:
I've checked the ownership of the files and it is ok ..
Is this the only script with the problem? Are you sure that perl runs on your server?
What happens if you run the Hello World script at the prompt:

Code:
#!/usr/bin/perl
print "Hello World\n";
Although I don't like this, but you can enable and then re-enable Suexec.
 

power_on

Member
Aug 10, 2004
8
0
151
The perl works

Tthe perl scrip is working from shell very good,

tried to put it in the cgi-bin directory

but it doesnt work from the browser,

I also tried another user account but it didnt work.

I disabled and re-enabled the suexec but it didn't work...

Any others Ideas...
 

AndyReed

Well-Known Member
PartnerNOC
May 29, 2004
2,217
4
193
Minneapolis, MN
power_on said:
Tthe perl scrip is working from shell very good,

tried to put it in the cgi-bin directory

but it doesnt work from the browser,
Did you check the log files to see if you get the same error message(s) when runing the "Hello World" script? Place the cgi script in a different directory other than the cgi-bin directory, and see if it works. What's the URL to the script? It could be your browser/PC!!!
 

power_on

Member
Aug 10, 2004
8
0
151
The same

The suexec log gives this

[2006-01-08 11:45:48]: info: (target/actual) uid: (hosting/hosting) gid: (hosting/hosting) cmd: test.pl

and the http error_log gives this

[Sun Jan 8 14:21:21 2006] [error] [client 82.201.169.18] Premature end of script headers: /home/vhosts/hosting/public_html/cgi-bin/test.pl
[Sun Jan 8 14:21:21 2006] [error] [client 82.201.169.18] File does not exist: /home/vhosts/hosting/public_html/500.shtml


thanx
 

Izzee

Well-Known Member
Feb 6, 2004
469
0
166
There is another thing you can try now we see the above error message. It is a very common error message and may be caused by creating the file in a windows editor like notepad and not uploading in unix ASCII format.

From shell you can use pico:
cd /directory/of/test.pl
pico test.pl

I also did a Google for "Premature end of script headers" include the " " which gave some useful info about this error and more options you can try.

:)
 

power_on

Member
Aug 10, 2004
8
0
151
Problem solved

The problem have been solved......

The problem was a permission problem but not in
cgi-bin dir or files in it :)

it was in the perl executable

/usr/bin/perl it was 754 and it ishoud be 755

#chmod 755 /usr/bin/perl

Thankk you for your support


Yahia.Salah
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,437
33
473
Go on, have a guess
Just incase anyone else comes across this thread in the future, that hello world test script will never work as a CGI script anyway. It should be like this:
Code:
#!/usr/bin/perl
print "content-type: text/html\n\n";
print "Hello World!";
 

linux-image

Well-Known Member
Jun 8, 2004
1,190
1
168
India
cPanel Access Level
Root Administrator
to add, the error can also happen in case the path of the perl given on the script is wrong.

it is always good to check on the path by a

#which perl

command and use the same.