RE: [PHP-WIN] problems with exec function

From: Date: Fri, 13 Sep 2002 18:58:15 +0000
Subject: RE: [PHP-WIN] problems with exec function
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-15797@lists.php.net to get a copy of this message
Christian What happens if you use passthru() instead of exec()? Rich -----Original Message----- From: Christian Pichler [mailto:Christian.Pichler@cpm-consulting.com] Sent: 13 September 2002 00:08 To: 'php-windows@lists.php.net' Subject: [PHP-WIN] problems with exec function Hey there, My problem is following. I want to execute a PHP program (here: test2.php) by another PHP program (here: test1.php) and get the return code of the second executed PHP Program. But I always get the return code 0. Even if I write 'return 50' in test1.php. But the rest of test1.php is working. Because if I print the value of the output variable (test2.php), there's all the output of test1.php. Does anybody know why this doesn't work? Thanks in advance! test1.php: ========== <?php $i = 0; echo "Commandline - Parameter\n\n"; print("PHP-Version: " . phpversion() . "\n\n"); print("Result: \n\n"); print("Value of argc: " . $argc . "\n\n"); print("Value(s) of argv: \n"); for ($i = 0; $i < $argc; $i++) { print("argv[" . $i . "]: " . $argv[$i] . "\n"); } return $argc; ?> test2.php: ========== <?php $res = ""; $command = "c:\\php\\php.exe -f c:\\test1.php param1 param2 param3"; $output = array(); $retval = 0; echo "Calling another one...\n\n"; $res = exec($command, $output, $retval); print ("Following value was returned by exec: " . $retval . "\n"); ?> -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.windows (#15797) next »