Laravel Horizon: requires ext-posix, missing from CentOS

Here’s what I ran into when I tried to install a project that required laravel/horizon via Composer.

$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for laravel/horizon v1.0.3 -> satisfiable by laravel/horizon[v1.0.3].
    - laravel/horizon v1.0.3 requires ext-posix * -> the requested PHP extension posix is missing from your system.
...

The error message requires ext-posix * -> the requested PHP extension posix is missing from your system is actually confusing. On CentOS, there’s no PHP package called ‘posix’, even though the PHP module is called POSIX.

$ php -m | grep posix

(If that doesn’t return any results, the posix extension is missing.)

On CentOS, the package you’re looking for is called process, as it contains a set of functions/methods to help with creating child processes, sending signals, parsing ID/GIDs, …

If you’re using the IUS repositories on CentOS/Red Hat, you can install them via;

$ yum install php71u-process

Afterwards, if you run composer again, it’ll work. To verify if the posix extension is installed properly, run php -m again.

$ php -m | grep posix
posix

Now, the posix extension is installed.