How to Install the Ext-Curl Extension with PHP 7

How do I install the ext-curl extension with PHP 7?

Well I was able to install it by :

sudo apt-get install php-curl

on my system. This will install a dependency package, which depends on the default php version.

After that restart apache

sudo service apache2 restart

Composer install error - requires ext_curl when it's actually enabled

This is caused because you don't have a library php5-curl installed in your system,

On Ubuntu its just simple run the line code below, in your case on Xamp take a look in Xamp documentation

sudo apt-get install php5-curl

For anyone who uses php7.0

sudo apt-get install php7.0-curl

For those who uses php7.1

sudo apt-get install php7.1-curl

For those who use php7.2

sudo apt-get install php7.2-curl

For those who use php7.3

sudo apt-get install php7.3-curl

For those who use php7.4

sudo apt-get install php7.4-curl

For those who use php8.0

sudo apt-get install php8.0-curl

Or simply run below command to install by your version:

sudo apt-get install php-curl

How to install php-curl in Ubuntu 16.04

In Ubuntu 16.04 default PHP version is 7.0, if you want to use different version then you need to install PHP package according to PHP version:

  • PHP 7.4: sudo apt-get install php7.4-curl
  • PHP 7.3: sudo apt-get install php7.3-curl
  • PHP 7.2: sudo apt-get install php7.2-curl
  • PHP 7.1: sudo apt-get install php7.1-curl
  • PHP 7.0: sudo apt-get install php7.0-curl
  • PHP 5.6: sudo apt-get install php5.6-curl
  • PHP 5.5: sudo apt-get install php5.5-curl

Composer install missing curl-ext

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.



Related Topics



Leave a reply



Submit