I searched high and low, but all the suggestions and tips I found did not work for some reason. I have a batch file that is called as such:
cmd /C "automateMyProgram.bat >> automation.log 2>>&1"
This works fine: automation.log loads with all stdout and stderr for this particular batch file. However, in this batch of script, I have the following command:
start php updateDB.php param1 param2 ^> updateDB.log
The PHP script runs just fine and reads fine in the parameters, but updateDB.log is never created. I made sure that the php error message in the php.ini file is configured to output errors to the command line interface. There are several echo expressions in the php script that I need to write to the log, but for some reason they are not output. I read that if you use the start command to invoke a program, you must use the carriage operator to redirect the output, since the program starts in a new process. I also tried:
start php updateDB.php param1 param2 >> updateDB.log
and that didn't work either. So I then tried:
start /B "Database Update" "php" "param1" "param2" >> updateDB.log
and this did not work from the batch file, but it happened when I copied and pasted it directly into the CMD window on the desktop.
Can any of you know how I can redirect the output of a php script that is being called from a batch file?
Thanks for your time and help!
windows scripting php batch-file
ariestav
source share