PHP's process control (pcntl) extension provides a set of highly underrated tools for scripts invoked at the command line, exposing behaviors that you might have thought only existed for compiled applications, such as forking and signal handling. We'll dive into these behaviors, including fun diversions like making a process zombie that rises from the dead when you hit Ctrl-C, and a parallel utility that uses multiple processes to get things done faster. We'll also take a look at Symfony's Process component that can be used to execute additional command lines safely and asynchronously, whether you need to run those commands from a web cotext or a CLI.

Comments

Comments are closed.

Thanks for making me realize how little I know about the PHP CLI, Ian!

Full of great information and ideas, but could benefit from a high-level look at processes, threads, signals, etc. at the top of the talk to help set some base terms.

Lots of great info. Glad you shared all the example code.

This was really interesting, and covered a lot of stuff that was completely new to me. I could definitely have benefited from a little more intro to certain terms at the beginning.

I have used the Symfony Process component a lot so I was excited to see that bit covered, it's such a great library to make this sort of work easier. I'm going to have to check out some of the other tools Ian covered.