CGI problems

Hello,

I have some CGI programs and I encountered some problems to run them.

First, in /etc/httpd/conf.d/mydomaine.com I’ve had to comment the line

#suexecUserGroup toto toto

and add this line in <directory>

<Directory /home/myaccount/mydomaine.com/html>
AllowOverride AuthConfig FileInfo Options Limit Indexes
Options +ExecCGI
</Directory>

After that all CGI programs are running well less one.

I have the perldesk cgi program which didn’t work
I have this error

You have no license for using PerlDesk! at /usr/lib/perl5/5.8.0/CGI/Carp.pm line 314. Compilation failed in require at (eval 2) line 3. …propagated at /usr/lib/perl5/5.8.0/base.pm line 64. BEGIN failed–compilation aborted at lib/PerlDesk/App/PDesk.pm line 4. Compilation failed in require at /home/carathos/carat-hosting.com/html/support/pdesk.cgi line 25

The perldesk helpdesk (find that funny) said me this

Anyway it its not license problem. PD in most cases starts error message with such words “You have no license for using PD”. As we may learn from next lines “… at /usr/lib/perl5/5.8.0/CGI/Carp.pm line 301…”. Seems like some base perl modules are corrupted.

So I’d reisntalled the CGI::Carp module, but I have the same pbm.

I’m very suprised to locate Carp.pm in 2 directories with 2 differents version (1.01 and 1.28)

[root@padawan CGI]# locate Carp.pm
/usr/lib/perl5/5.8.0/Carp.pm (v1.01)
/usr/lib/perl5/5.8.0/CGI/Carp.pm (v1.28)

I don’t know where this module should be,so I can’t figure out what happens

For my personnal knowledge, why I have two Digest directories one in /site_perl/5.8.0/Digest and the other in /site_perl/5.8.0/i386-linux-thread-multi/Digest

Do you have any idea ?

Any helps or advises are realy welcomed

Thanks
Pascal

Ps : I have other CGI program that run without pbm

Ok my problem is solved :slight_smile:

In fact it’s a general RH9 / Fedora / CentOS problem.

You have to setup the LANG to en_US


LANG=en_US
export LANG

and all my CGI and perl modules problems disapeared !!!

so now I have include these tw lines in /etc/rc.locale to be sure to not forget to set it up once more time

But I’d like to figure out why I’ve had to comment the line suexecUserGroup

If that may help somebody :slight_smile:

Thanks
Pascal

I haven’t got a clue, but I do remember having to comment out that line when I had FrontPage set up on my old box because the error message told me the group did not exist even though it did. Odd.

I just ran into this problem as well. I cant disable the suexec because or some other scripts :frowning:

Any thoght how to fix this?

the error logs are useless here :frowning:

Can you clarify which problem you’re seeing exactly? One thing that catches me every so often is that CGI’s get uploaded in binary mode instead of ASCII. You can run the dos2unix command to convert it or reupload it. If you run the dos2unix command as root, double check the ownership and execute permissions, you’ll probably need fix them.

dos2unix somefile.cgi

The ‘Premature end of script headers’, same as the OP.

'I have tried chowning it to both the user, as well as root, apache, and its chmoded 755, the containing directory is also 755. In the conf.d/site.conf the directory is Options +ExecCGI.

I wrote it in vi via ssh, its just a simple hello World. no uploading involved.

#!/usr/bin/perl

print "Content-type: text/html

";

print "<html><head>
";
print "<title>Hello, world!</title></head>
";
print "<body bgcolor=\"#FFFFFF\" text=\"#000000\" link=\"#FF0000\" vlink=\"#800000\">
";
print "<h1>Hello, world!</h1>
";
print "</body></html>
";

doing a ./hello.cgi via ssh outputs what it should.

Could you check the /var/log/httpd/suexec.log just to make sure there’s nothing relevant in there?

Paul

This is all its says: dont know what it means though :frowning: (Im pretty sure it isnt the Apache 504)

[2004-11-08 15:26:06]: uid: (504/bettersl) gid: (504/504) cmd: hello.cgi
[2004-11-08 15:26:06]: directory is writable by others: (/home/bettersl/bettersleeppillow.com/html/tst)

The 504’s just refer to the linux user and group IDs.

The directory /home/bettersl/bettersleeppillow.com/html/tst is writable by “everyone” and suiexec considers this a security risk and therefore is not letting the script run in the browser. Fix this with a

chmod 755 /home/bettersl/bettersleeppillow.com/html/tst

Paul

Now getting:
[2004-11-08 15:43:17]: uid: (504/bettersl) gid: (504/504) cmd: hello.cgi
[2004-11-08 15:43:17]: target uid/gid (504/504) mismatch with directory (0/0) or program (504/0)

The directory, its parent, and the cgi itself is owned by the ‘correct’ user, bettersl

To add to the oddness, ive copied it to another site on the same server, and its works fine :frowning:

Suexec seems to think that root is owning the directory that hello.cgi is in. If that’s not the case, I’m pretty confused, since I’ve never seen it be wrong about this type of thing. I’d be happy to take a look if you like, you can drop login info here: http://interworx.info/rootdrop

Paul

sent. thanks.

I found the problem, I should have been more clear.

Both the owner and the “group owner” need to be set to correct unix user/group

[root@server1 html]# ls -la tst
total 260
drwxr-xr-x 2 bettersl root 4096 Nov 8 15:13 .
drwxr-xr-x 20 bettersl bettersl 4096 Nov 8 14:29 …
-rwxr-xr-x 1 bettersl root 216988 Nov 8 14:29 admin.cgi
-rwxr-xr-x 1 bettersl root 4687 Nov 8 14:29 clickthru.cgi
-rwxr-xr-x 1 bettersl root 2536 Nov 8 14:29 common.cgi
-rwxr-xr-x 1 bettersl root 2641 Nov 8 14:29 config.cgi
-rwxr-xr-x 1 bettersl root 2153 Nov 8 14:29 getcookie.cgi
-rwxr-xr-x 1 bettersl root 276 Nov 8 15:13 hello.cgi
-rwxr-xr-x 1 bettersl root 10049 Nov 8 14:29 sale.cgi
[root@server1 html]#

I fixed it. You can do it with either

chown -R bettersl.bettersl tst
or
chgrp -R bettersl tst

nifty, thanks.