my terminology my be off, but here goes:
lets assume one executes:
/bin/somecommand
using exec or system in php
the above command returns ‘exit code’ (this is the terminology that may be off) ‘1’.
is it possible to fetch this value via php?
if possible, do this without using a ‘parent’ bash script. we would love to be able to fetch this directly from php rather then having to run a parent bash script, and have that script echo out the exit code.
thanks!
The manual for exec() shows that you can provide an optional third argument to collect the return status (exit code). Similarly for system(), a second optional argument.
Example from that page: