I tried emulating artisan's serve command by using shell_exec()
. But somehow once it boots up the terminal is blocked. I also tried running it in background and storing the output to a variable:
shell_exec("php -S localhost:8000 &"); // runs the server but blocks the terminal
$result = shell_exec("php -S localhost:8000 &> /dev/null 2>&1"); echo $result; // this does not show anything
The idea is so that I can create custom messages once php server is up.
Did you tired this!
"This function can return NULL both when an error occurs or the program produces no output. It is not possible to detect execution failures using this function. exec() should be used when access to the program exit code is required."
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.