9

I am developing some PHP on Ubuntu 14.04.4 LS. Running composer install is failing and I can't figure it out. This was working earlier when I was using PHP 5.5.9, but I had to update to at least 5.6 in order to install phpunit.

Running php -v outputs:

PHP 5.6.23-1+deb.sury.org~trusty+2 (cli) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

Running which php outputs:

/usr/bin/php

which is kind of suspicious as it doesn't match php -v (/usr/bin has: "php", "php5", and "php5.6")

Here is my composer.json:

{
    "require-dev": {
        "phpunit/phpunit": "5.4.*"
    },
    "require": {
        "silex/silex": "~1.3",
        "stripe/stripe-php": "3.*"
    }
}

Running composer install creates this output:

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

  Problem 1
- stripe/stripe-php v3.9.2 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.9.1 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.9.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.8.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.7.1 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.7.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.6.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.5.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.4.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.3.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.2.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.14.3 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.14.2 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.14.1 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.14.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.13.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.12.1 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.12.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.11.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.10.1 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.10.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.1.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.0.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.14.2 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- Installation request for stripe/stripe-php 3.* -> satisfiable by stripe/stripe-php[v3.0.0, v3.1.0, v3.10.0, v3.10.1, v3.11.0, v3.12.0, v3.12.1, v3.13.0, v3.14.0, v3.14.1, v3.14.2, v3.14.3, v3.2.0, v3.3.0, v3.4.0, v3.5.0, v3.6.0, v3.7.0, v3.7.1, v3.8.0, v3.9.0, v3.9.1, v3.9.2].

To enable extensions, verify that they are enabled in those .ini files:
- /etc/php/5.6/cli/php.ini
- /etc/php/5.6/cli/conf.d/10-opcache.ini
- /etc/php/5.6/cli/conf.d/10-pdo.ini
- /etc/php/5.6/cli/conf.d/20-calendar.ini
- /etc/php/5.6/cli/conf.d/20-ctype.ini
- /etc/php/5.6/cli/conf.d/20-exif.ini
- /etc/php/5.6/cli/conf.d/20-fileinfo.ini
- /etc/php/5.6/cli/conf.d/20-ftp.ini
- /etc/php/5.6/cli/conf.d/20-gettext.ini
- /etc/php/5.6/cli/conf.d/20-iconv.ini
- /etc/php/5.6/cli/conf.d/20-json.ini
- /etc/php/5.6/cli/conf.d/20-phar.ini
- /etc/php/5.6/cli/conf.d/20-posix.ini
- /etc/php/5.6/cli/conf.d/20-readline.ini
- /etc/php/5.6/cli/conf.d/20-shmop.ini
- /etc/php/5.6/cli/conf.d/20-sockets.ini
- /etc/php/5.6/cli/conf.d/20-sysvmsg.ini
- /etc/php/5.6/cli/conf.d/20-sysvsem.ini
- /etc/php/5.6/cli/conf.d/20-sysvshm.ini
- /etc/php/5.6/cli/conf.d/20-tokenizer.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

I followed these instructions but it doesnt work: Composer install error - requires ext_curl when it's actually enabled

Running php -i | grep php.ini outputs:

Configuration File (php.ini) Path => /etc/php/5.6/cli
Loaded Configuration File => /etc/php/5.6/cli/php.ini

Running: sudo apt-get install php5-curl outputs:

php5-curl is already the newest version.

Running curl -V outputs:

curl 7.35.0 (x86_64-pc-linux-gnu) libcurl/7.35.0 OpenSSL/1.0.1f zlib/1.2.8 libidn/1.28 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smtp smtps telnet tftp 
Features: AsynchDNS GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP 

Any help is appreciated.

1
  • Typing dpkg -l | grep 'php5-curl' outputs: ii php5-curl 5.6.23+dfsg-1+deprecated+dontuse+deb.sury.org~trusty+1 amd64 CURL module for php5 Commented Jun 27, 2016 at 12:43

3 Answers 3

25

Execute this: sudo apt-get install php-curl

Sign up to request clarification or add additional context in comments.

Comments

7

Some notes:

  • Running php -i is good. It shows you the php.ini used, so that you know which file to edit.
  • Running curl -v is not needed, because that's the standalone curl for usage on the CLI and unrelated to the PHP Extension curl.
  • You checked for php5-curl, that's the needed package. Ok.

What's missing? You need to make sure the extension is also loaded by PHP!

Edit your /etc/php/5.6/cli/php.ini, search for extension, look for php_curl and enable it: extension=php_curl.so.

Then run php -m on the CLI to see the list of loaded modules and ensure that curl is loaded.

Finally, re-run your composer install.

5 Comments

Thank you for the response. The php.ini file does not have a php_curl.so -- it has php_curl.dll, but that's for windows and I'm on Ubuntu. Enabling this line did not work. The file only has two .so mentions, both for mysql. I got the "extensions_dir" from phpinfo(), and there is a "curl.so" in that directory. I followed the instructions from here as well: stackoverflow.com/questions/23233460/… and the file /etc/php5/mods-available/curl.ini does exist, and it does have "extension=curl.so" in it. Updating question above.
Right, when on Linux/Ubuntu you need to enable the .so file. I wonder why enabling that didn't work, when you already found the php_curl.so file in the extension folder. Please check with php -m, if it is loaded. -- If it is not loaded, i think you are still editing the wrong php.ini for the PHP you are using on the CLI. Keep in mind that there a differnt php.ini files - for web requests and for the CLI.
php -m does not list curl. The command php -i | grep php.ini makes me think I am editing the proper php.ini file. In that php.ini file I added extension=/path/to/extensions/curl.so (got the path from the output of phpinfo()) and now php -m lists curl. Now when I run composer install I am getting an error about another missing package (ext-mbstring), so that seems to work.
But the fact that I keep getting errors makes me think something is wrong. Typing dpkg -l | grep 'php5-curl' outputs: ii php5-curl 5.6.23+dfsg-1+deprecated+dontuse+deb.sury.org~trusty+1 amd64 CURL module for php5. Notice it has "deprecated+dontuse" in there. When upgrading my PHP version, it did not go smoothly, I saw this "deprecated" message and did another upgrade to a higher version. Perhaps I will uninstall all PHP and start again.
Glad it worked out. | Well, if the curl extension is properly loaded and you don't get an API conflict between PHP extension and PHP core displayed, when you run PHP, then it simply works - even if it is flagged as deprecated. | If you get an API mismatch, then reinstalling PHP with extensions might clear the situation.
0

if ubuntu is not a server edition, and the webserver was installed with tasksel try installing php apt-get install php

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.