Search code examples
phpmongodbcomposer-phpfpm

PHP Composer with FPM config


When I try to install MongoDB with composer, it complains that I don't have the mongodb extension configured in my ini files. It's looking at the regular php ini files but mine are under /fpm as I'm using nginx. How can I tell composer to use the FPM version of PHP?


Solution

  • I found two solutions: (after I figured out that composer uses the php-cli configuration)

    1. Link the php-fpm configuration into the php-cli configuration, as detailed in:

    http://paulwhippconsulting.com/blog/getting-php-cli-to-match-php5-fpm-so-it-behaves-consistently-under-nginx/

    This seems more elegant, but doesn't seem to be official so it may break.

    1. Copy all your configuration directives (.ini files) to both the php-cli and the php-fpm configuration directories.

    The downside of this ofcourse is that if not done carefully, your production and development environment end up having different configuration settings.