Christian What happens if you use passthru() instead of exec()? Rich -----Original Message----- From: Christian Pichler [mailto:[EMAIL PROTECTED]] Sent: 13 September 2002 00:08 To: '[EMAIL PROTECTED]' 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 -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php