FS#42467 - [php-composer] Custom php.ini causes Composer to fail when certain extensions are required

Attached to Project: Arch Linux
Opened by Jakob Gahde (J5lx) - Monday, 20 October 2014, 20:02 GMT
Last edited by Pierre Schmitz (Pierre) - Sunday, 22 November 2015, 12:01 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Pierre Schmitz (Pierre)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 20
Private No

Details

Description:

The package uses a custom shebang which advises PHP to use a custom php.ini (/usr/share/php-composer/php.ini). However in that php.ini only the extensions openssl, phar, zip, curl, and intl are enabled which causes Composer to fail when other extensions are required by packages (using the ext-<extname> syntax), even when they are enabled in the default php.ini (/etc/php/php.ini).

Steps to reproduce:

1. mkdir /tmp/composer-test && cd /tmp/composer-test
2. composer require ext-gettext:*
3. Composer will fail with the error message "The requested PHP extension ext-gettext * is missing from your system." even tough it is enabled in the default php.ini (by default).
This task depends upon

Closed by  Pierre Schmitz (Pierre)
Sunday, 22 November 2015, 12:01 GMT
Reason for closing:  Fixed
Additional comments about closing:  system php.ini is used.
Comment by Peter Mellett (mellett68) - Wednesday, 22 October 2014, 13:24 GMT
Just got stung by this, Composer doesn't reveal which php.ini it's working with (although there is a PR for it: https://github.com/composer/composer/pull/3177)
Comment by Shinya Yamaoka (shinnya) - Sunday, 28 December 2014, 12:17 GMT
I think it isn't the reported problem that users can't know what extensions are required for using composer, but that *implicitly* specifying the path of php.ini in /usr/bin/composer on archlinux makes users confused. In my opinion, it's more clear for /usr/bin/composer to use /etc/php/php.ini.
Comment by Jakob Gahde (J5lx) - Wednesday, 14 January 2015, 21:56 GMT
That's right.
Comment by Norbert Fuksz (Fuxy) - Tuesday, 05 May 2015, 11:55 GMT
Just got bit by this myself.

Is there any particular reason for having a separate .ini file because this seems to create more problems than it solves.

I have not run into anything like this in any other distro.
Comment by Damián Nohales (eagleoneraptor) - Tuesday, 05 May 2015, 22:52 GMT
So, what happened here?
Comment by Matthew G (djmattyg007) - Sunday, 31 May 2015, 02:38 GMT
I just got bitten by this while attempting to run 'composer install' with a package that required ext-iconv. I'd really appreciate it if this was fixed, or at least an explanation given as to why composer needs its own php.ini file.
Comment by Stephen Smith (Stephen304) - Tuesday, 30 June 2015, 21:27 GMT
Every other distro has composer use the normal php ini. I spent 3 hours trying to figure out why composer complained about mcrypt for laravel. Good thing I get paid by the hour.
Comment by Alex Lobtsov (grevus) - Saturday, 12 September 2015, 12:48 GMT
Or add conf.d folder for composer. You can use include.
Comment by Artjom Simon (artjom.simon) - Wednesday, 14 October 2015, 12:19 GMT
I just lost 2 hours trying to figure out why "composer install" in a Symfony project failed with "[PDOException] could not find driver" although I had pdo_mysql in my /etc/php/ini.php
After symlinking /usr/share/php-composer/php.ini to /etc/php/php.ini, everything works.

This really should be fixed.
Comment by Matthew G (djmattyg007) - Thursday, 15 October 2015, 09:30 GMT
This bug report is almost one year old. Why has there been no response from the maintainer, not even to explain the rationale of using a separate php.ini file?
Comment by Norbert Fuksz (Fuxy) - Thursday, 15 October 2015, 11:41 GMT
Good question. This bug has also got quite a lot of votes so my only guess is he isn't looking at bug reports at all.

Is there any way we can fix it without him?

(Sent a email to the assignee hopefully he will finally respond.)
Comment by Evgeny Ukho (alarm) - Wednesday, 28 October 2015, 19:59 GMT
+1 from me.
Today I spent (like other guys from this thread several hours to understand why composer didn't see sockets extension =(
In opposite of ubuntu server, where everything works.
Comment by Pierre Schmitz (Pierre) - Sunday, 22 November 2015, 12:01 GMT
Sorry this bug report got lost. The current packages does no longer ships the custom ini file that was needed for build and test.

This also means the system php.ini has to be adjusted by the user and composer does not work out of the box. This is the intended upstream behaviour though and should not have been altered.

Loading...