fail running an external C program into a Perl CGI script

Y

yairl

hi,

I 'm trying to execute a small C program into the Perl CGI working
with apache server and it fail . I used `cmd` , sytem, qx( ) , open
orders every thing it doens't work when it run as CGI. The script
works fine if it runs as shell script by hand or cron but the forked
program send "segmentation fault" and it ended with status 35584
(ACCESS VIOLATION) when it runs into CGI mode under apache server or
Sun One webserver. This happened with some C small programs they use
socket to connect some resources outside and return some value to
evaluate. These programs started to fail since perl 5.6 under linux
SuSe 9 ,10 and solaris 8 and 9. The regular OS orders like date, cat ,
cal work fine, I tested it. I don't understand why is happened, what's
wrong they are common C progrmas using the standard C library like
socket lib. Someone know anything about this bug?
 
S

smallpond

hi,

I 'm trying to execute a small C program into the Perl CGI working
with apache server and it fail . I used `cmd` , sytem, qx( ) , open
orders every thing it doens't work when it run as CGI. The script
works fine if it runs as shell script by hand or cron but the forked
program send "segmentation fault" and it ended with status 35584
(ACCESS VIOLATION) when it runs into CGI mode under apache server or
Sun One webserver. This happened with some C small programs they use
socket to connect some resources outside and return some value to
evaluate. These programs started to fail since perl 5.6 under linux
SuSe 9 ,10 and solaris 8 and 9. The regular OS orders like date, cat ,
cal work fine, I tested it. I don't understand why is happened, what's
wrong they are common C progrmas using the standard C library like
socket lib. Someone know anything about this bug?


Most likely you are trying to execute a program in a directory
or as a user that does not have proper permission. This is
more likely an apache problem than perl. Check httpd.conf.
 
J

Jürgen Exner

I 'm trying to execute a small C program into the Perl CGI working
with apache server and it fail . I used `cmd` , sytem, qx( ) , open
orders every thing it doens't work when it run as CGI. The script
works fine if it runs as shell script by hand or cron but the forked
program send "segmentation fault" and it ended with status 35584
(ACCESS VIOLATION) when it runs into CGI mode under apache server or
Sun One webserver.

You have a close cousin to "Server error 500", see "perldoc -q 500" for
details.

jue
 
S

smallpond

You have a close cousin to "Server error 500", see "perldoc -q 500" for
details.

jue

My mistake. Based on the FAQ, I was not supposed to give a polite
answer.
 
T

Tim Greer

smallpond said:
My mistake.  Based on the FAQ, I was not supposed to give a polite
answer.

That made me laugh. Thanks.
 
T

Tim Greer

hi,

I 'm trying to execute a small C program into the Perl CGI working
with apache server and it fail . I used `cmd` , sytem, qx( ) , open
orders every thing it doens't work when it run as CGI. The script
works fine if it runs as shell script by hand or cron but the forked
program send "segmentation fault" and it ended with status 35584
(ACCESS VIOLATION) when it runs into CGI mode under apache server or
Sun One webserver. This happened with some C small programs they use
socket to connect some resources outside and return some value to
evaluate. These programs started to fail since perl 5.6 under linux
SuSe 9 ,10 and solaris 8 and 9. The regular OS orders like date, cat ,
cal work fine, I tested it. I don't understand why is happened, what's
wrong they are common C progrmas using the standard C library like
socket lib. Someone know anything about this bug?

Are you using a script or program that's suid/sgid, or running SuEXEC
for CGI? This doesn't sound like a Perl issue, as others have said.
 
Y

yairl

Are you using a script or program that's suid/sgid, or running SuEXEC
for CGI?  This doesn't sound like a Perl issue, as others have said.
--
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting.  24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!- Hide quoted text -

- Show quoted text -

first thanks to everybody that answered.
It's a common CGI script running into cgi-bin. I don't think it's a
permition problem because i can execute shell orders. It's something
into these C programs that it doesn't work correctly in the webserver
enviroment.
I read some post in this forum talking about the output buffering
problem, it sound me that may be the point. I'm going to test the
Expect module and check if it solve the problem. Anyway if the Expect
module doesn't work I decided to rewrite this program in perl as perl
module. I did it before with others small C programs that stoped to
work.
 
K

Kiss Gabor

[/QUOTE]
first thanks to everybody that answered.
It's a common CGI script running into cgi-bin. I don't think it's a
permition problem because i can execute shell orders. It's something
into these C programs that it doesn't work correctly in the webserver
enviroment.

Why don't you trace apache processes and their children?

Gabor
 
Y

yairl

Why don't you trace apache processes and their children?

Gabor

I did more debug and i found that the C program running into the CGI
under the webserver user can't read or use the socket then it produce
a null pointer and crash. The script works only under root privileges,
i don't understand how before worked and now not. The problem is
connected to permitions to use sockets. i don't have more time to
waste with it then we'll write a perl module for this task, always
modules work fine...
 
K

Kiss Gabor

I did more debug and i found that the C program running into the CGI
under the webserver user can't read or use the socket then it produce
a null pointer and crash. The script works only under root privileges,

Eeeeer.... you should always check return value of library functions.

Gabor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top