How can I catch a background process error in PHP? I am running some commands to convert a PDF but sometimes the process gets killed. Is there anyway to monitor if the process has been completed successful ?
You can use system like flaging. on start up of each background process keep a separate flag_processId = 0 for those process and on successful completion of that process update that flag to 1. and if that process getting any error in between and if it is detactable then update it to not completed flag (eg flag = 2).
By this you can keep track of that background process dynamically.
or for detecting killing reason you can also use logging to log file.
after each step in that process log completion of that step in log file, by this you can get where your process is getting killed.
Wrap the background process in a script which monitors it.
error_log
file in the folder where script is residing.
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.