If you have composer installed (the package manager for PHP), you can get the following ‘error’ message when you try to run a composer install
.
$ composer install Loading composer repositories with package information [Composer\Downloader\TransportException] The "https://packagist.org/packages.json" file could not be downloaded: allow_url_fopen must be enabled in php.ini (https:// wrapper is disabled in the server configuration by allow_url_fopen=0 failed to open stream: no suitable wrapper could be found) install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--] [<packages>]...
The easiest fix is just to set the allow_url_fopen option to On in php.ini
. But that enables it server-wide, you may not want that.
Here’s a simple workaround, by setting the option when calling the composer binary.
$ which composer /usr/local/bin/composer $ php -d allow_url_fopen=on /usr/local/bin/composer install
By calling the php binary with the -dallow_url_fopen=on
parameter, you’re overwriting the php.ini for that invocation of composer. So you can bypass the php.ini settings altogether.