Hi,
        I'm having trouble spawning a sub-process from mod_perl. I've read
the guide and it recommends spawning, handing the info the process needs and
have it detach (close STDIN,STDOUT and STDERR + execute setsid()). I'm not
sure how to go about this correctly. If any one can give me a few lines of
code I would appreciate it.
I've successfully spawned the server using the system command from a
standalone perl program but the system command always fails in my mod_perl
script.
The command i use is:

system("./cserver &") or die "system cserver failed: $?";

what i get in the error log is:

null:system cserver failed: 0 at /home/httpd/perl/test.pl line 35

the permissions on the executable cserver located in /home/httpd/perl/ is
-rwxr-xr-x (executable by everyone!)

The reason i put it in the backround is to allow the main mod_perl script to
continue and connect to the cserver process via unix domain sockets (after a
small delay)
and exchange the required info (an XML string but thats irrelevant). The
cserver process will login to a database, retrieve info and the plan is to
send it back to the mod_perl process through the socket and all the way back
to the client. (This is asking for trouble i'm sure! overhead, denial of
service attacks etc..)
Can anyone tell me why the above system & command doesn't work from mod_perl
(it is succesfull in starting the cserver in a normal perl script)
and can anyone also tell me if i'm completely insane in the way i'm going
about this!

Apache/1.3.12 (Red Hat linux 6.2)
mod_perl/1.21
Perl 5.00503

Any help would be greatly appreciated!

Thomas Reilly
Software Consultant,

Distributed Software Consultancy Ltd.,
Ballybrit Business Park,Galway,Ireland.
Tel: +353 (91) 760541 Fax: +353 (91) 760542
e-mail: [EMAIL PROTECTED]
web: http://www.dscie.com


Reply via email to