Page 1 of 1

exec(PERL) winNT IIS hanging

Posted: Mon Aug 18, 2003 6:51 pm
by rxsid
Hi all,

Using PERL 5.6.1.631, PHP 4.3.1, win NT4.0 & iis webserver.

Trying to call a PERL script from within my PHP script. The PERL script works find from the command line, but causes the browser (I.E.) to hang if called by the PHP web script.

tried with path to perl executable:

Code: Select all

exec("C:\\Perl\\ntt\\perl.exe C:\\pathto\\PERLscript\\test.pl");

[\php]

also tried

Code: Select all

exec("start C:\\pathto\\PERLscript\\test.pl");

[\php]

And several other flavors, but can't get the script to execute.  The perl binary & path & script has iis guest internet user permissions set to full control.  So full paths are being indidated, and the binaries/paths/code has full permissions.

Any ideas why my call to the PERL script would be hanging?

Thanks for any help/suggestions!

Posted: Mon Aug 18, 2003 9:26 pm
by Stoker
tried with a hello-world perl script? e.g. does it execute the script at all?
What happens if you execute the php script from command line, does it still hang?

Posted: Tue Aug 19, 2003 5:47 pm
by rxsid
this is the perl script which works just fine from the command line:

Code: Select all

$filetest = "testingFile.txt";

open(THISTEST, ">>I:\\path\\to\\$filetest");
print THISTEST "TESTING";
close (THISTEST);
but when called from a php script, the browser just hangs and hangs.

Posted: Tue Aug 19, 2003 7:39 pm
by qartis
Have you tried the other flavours of executing system commands? Namely..

Code: Select all

system("command");
passthru("command");
`command`; /* Those are backticks */

Posted: Wed Aug 20, 2003 8:48 am
by Stoker
since the script deals with file I/O i suspect permission issues..

Again: Does a hello world script work?

Posted: Wed Aug 20, 2003 2:34 pm
by rxsid
I have tried system() & passthru(), and yes i've tried the simple Hello World.

All the above cause the browser to hang.

Posted: Wed Aug 20, 2003 2:50 pm
by Stoker
ok, if a hello world cause the browse to hang it is obveius that the permission requirements to execute the perl intepreter from PHP is not met.

Using the hello world perl script called from a PHP script, if you execute the PHP script from command line, what happens?

Posted: Wed Aug 20, 2003 4:56 pm
by rxsid
thanks for the pointers Stoker, I've finally got it working.

1st: The file type .pl or .cgi wasn't properly setup in the windows file extension list.

2nd: I was missing a perl100.dll, which I happened to have in an older (backed up) perl installation. So I just copied that dll into the dir where the perl executable is.

Calling PERL scripts from PHP web scripts now work.

Thanks.