composer: Composer doesn't see all installed PHP extensions
I’m using Docker and have installed GD in recommended way as showed in official PHP Docker repository. My Dockerfile looks like this:
When I run:
php -m
I’m getting:
[PHP Modules]
Core
ctype
curl
date
dom
ereg
fileinfo
filter
ftp
gd
hash
iconv
json
libxml
mbstring
mysqlnd
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
Reflection
session
SimpleXML
SPL
sqlite3
standard
tokenizer
xdebug
xml
xmlreader
xmlwriter
zlib
[Zend Modules]
Xdebug
but when running composer show -p
I’m getting:
ext-ctype 0 The ctype PHP extension (actual version: )
ext-curl 0 The curl PHP extension (actual version: )
ext-date 5.6.25 The date PHP extension
ext-dom 20031129 The dom PHP extension
ext-ereg 0 The ereg PHP extension (actual version: )
ext-fileinfo 1.0.5 The fileinfo PHP extension
ext-filter 0.11.0 The filter PHP extension
ext-ftp 0 The ftp PHP extension (actual version: )
ext-hash 1.0 The hash PHP extension
ext-iconv 0 The iconv PHP extension (actual version: )
ext-json 1.2.1 The json PHP extension
ext-libxml 0 The libxml PHP extension (actual version: )
ext-mbstring 0 The mbstring PHP extension (actual version: )
ext-mysqlnd 0 The mysqlnd PHP extension (actual version: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $)
ext-openssl 0 The openssl PHP extension (actual version: )
ext-pcre 0 The pcre PHP extension (actual version: )
ext-PDO 1.0.4dev The PDO PHP extension
ext-pdo_sqlite 1.0.1 The pdo_sqlite PHP extension
ext-Phar 2.0.2 The Phar PHP extension
ext-posix 0 The posix PHP extension (actual version: )
ext-readline 5.6.25 The readline PHP extension
ext-Reflection 0 The Reflection PHP extension (actual version: $Id: 5f15287237d5f78d75b19c26915aa7bd83dee8b8 $)
ext-session 0 The session PHP extension (actual version: )
ext-SimpleXML 0.1 The SimpleXML PHP extension
ext-SPL 0.2 The SPL PHP extension
ext-sqlite3 0.7-dev The sqlite3 PHP extension
ext-tokenizer 0.1 The tokenizer PHP extension
ext-xml 0 The xml PHP extension (actual version: )
ext-xmlreader 0.1 The xmlreader PHP extension
ext-xmlwriter 0.1 The xmlwriter PHP extension
ext-zlib 2.0 The zlib PHP extension
lib-curl 7.38.0 The curl PHP library
lib-iconv 2.19 The iconv PHP library
lib-libxml 2.9.1 The libxml PHP library
lib-openssl 1.0.1.20 OpenSSL 1.0.1t 3 May 2016
lib-pcre 8.38 The pcre PHP library
php 5.6.25 The PHP interpreter
php-64bit 5.6.25 The PHP interpreter, 64bit
php-ipv6 5.6.25 The PHP interpreter with IPv6 support
There’s no GD here, so when I try to install for example barryvdh/laravel-dompdf
I’m getting following error:
Problem 1
- dompdf/dompdf v0.7.0 requires ext-gd * -> the requested PHP extension gd is missing from your system.
- dompdf/dompdf v0.7.0 requires ext-gd * -> the requested PHP extension gd is missing from your system.
- dompdf/dompdf v0.7.0 requires ext-gd * -> the requested PHP extension gd is missing from your system.
- Installation request for dompdf/dompdf (locked at v0.7.0) -> satisfiable by dompdf/dompdf[v0.7.0].
The only way to install it is using --ignore-platform-reqs
parameter but I need to use it each time and obviously it doesn’t solve issue when my virtual machine misses some libs that are required and not installed.
Also when I run:
php -r 'print_r(get_loaded_extensions()); foreach (get_loaded_extensions() as $ext) echo $ext." ".phpversion($ext)."\n";'
in console I’m getting something like this:
Array
(
[0] => Core
[1] => date
[2] => ereg
[3] => libxml
[4] => openssl
[5] => pcre
[6] => sqlite3
[7] => zlib
[8] => ctype
[9] => curl
[10] => dom
[11] => fileinfo
[12] => filter
[13] => ftp
[14] => hash
[15] => iconv
[16] => json
[17] => mbstring
[18] => SPL
[19] => PDO
[20] => session
[21] => posix
[22] => readline
[23] => Reflection
[24] => standard
[25] => SimpleXML
[26] => pdo_sqlite
[27] => Phar
[28] => tokenizer
[29] => xml
[30] => xmlreader
[31] => xmlwriter
[32] => mysqlnd
[33] => gd
[34] => pdo_mysql
[35] => xdebug
)
Core 5.6.25
date 5.6.25
ereg
libxml
openssl
pcre
sqlite3 0.7-dev
zlib 2.0
ctype
curl
dom 20031129
fileinfo 1.0.5
filter 0.11.0
ftp
hash 1.0
iconv
json 1.2.1
mbstring
SPL 0.2
PDO 1.0.4dev
session
posix
readline 5.6.25
Reflection $Id: 5f15287237d5f78d75b19c26915aa7bd83dee8b8 $
standard 5.6.25
SimpleXML 0.1
pdo_sqlite 1.0.1
Phar 2.0.2
tokenizer 0.1
xml
xmlreader 0.1
xmlwriter 0.1
mysqlnd mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $
gd
pdo_mysql 1.0.2
xdebug 2.4.1
For some extensions version is missing but for example for ctype
it’s missing but it’s available in output of composer show -p
and gd
is not there at all.
I’ve already seen https://github.com/composer/composer/issues/4353 but it’s not solving the issue. The question is - what’s the reason that composer doesn’t see GD extension? What’s the way composer finds what extensions are available in system? Or maybe official way of installing GD is broken and it should be installed somehow else?
The strange thing is that GD is working without a problem after such installation, the only issue is that Composer doesn’t see it.
I’m using Composer version 1.2.1 2016-09-12 11:27:19
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 19 (8 by maintainers)
@alcohol @maryo I had exact same problem. I’ve created alias like this:
to not load Xdebug (but obviously all other extensions) and that’s why Composer didn’t see GD2 extension when installing packages.
Sorry for reporting. It was obviously not Composer fault but mine.
Note that latest composer (1.3+) disables xdebug automatically so you don’t need to do such hacks like running it via
php -n
anymore.In case this could help :
I ran into the same issue, I was running PHP locally with GD and composer thru a docker container. the command
composer show -p
would not show"ext-gd"
.To solve the problem, I’ve installed Composer locally and now it runs fine. Another solution would’ve been to install GD on the Composer container.
I think you are using the image that extends ubuntu stuff. It could be their fpm image has a separate php ini for fpm and cli. Did you try running
php --ini
?