简体   繁体   中英

bash exec stderror stdout to normal php error_log

Hi I'm running a PHP script via command line from a bash script. I am able to get the PHP errors appended to a single file with 2>> but I was wondering if I could send the errors to the standard PHP error_log file.

exec nohup php $PHP_SCRIPT_PATH 2>> $LOG_PATH & EPID=$!

Also when I do try to write to the php error_log file, I get write permission.

Thanks, Steve

Even if you get your permission problem managed this will not work, because you write from two processes to the same file. This will most likely produce garbage in the error_log.

You have to prevent PHP writing to the error_log. Instead you have to configure PHP to write to STDERR. And than you can redirect the output to a single file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM