0

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 ?

3 Answers 3

1

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 (e.g 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.

Sign up to request clarification or add additional context in comments.

Comments

1

Wrap the background process in a script which monitors it.

  • The script starts the PDF creator.
  • When the PDF creator is done, the script checks the output or exit code.
  • If the PDF creator crashes or is killed, the script can still take some action.

Comments

0
  1. Look into the server error logs.
  2. Look into the error_log file in the folder where script is residing.
  3. Try making small PDFs. Most of the time, these PDF makers crash on large files / data.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.