I have installed ubuntu Lamp stack. But the curl is not enabled, neither can I can find the extension listed in the INI file. I added manually but it didn't work either.
How should I enable Curl then?
I have installed ubuntu Lamp stack. But the curl is not enabled, neither can I can find the extension listed in the INI file. I added manually but it didn't work either.
How should I enable Curl then?
From http://buzznol.blogspot.com/2008/12/install-curl-extension-for-php-in.html:
sudo apt-get install php5-curl
After installing libcurl you should restart the web server with one of the following commands,
sudo /etc/init.d/apache2 restart
OR sudo service apache2 restart
You only have to install the php5-curl library. You can do this by running
sudo apt-get install php5-curl
Click here for more information.
Try
sudo apt-get install php-curl
it worked on fresh Ubuntu 16.04 LTS, with lamp-server and php7. I tried with php7-curl
- didn't work and also didn't work with php5-curl
For those, who is trying to install php-curl on PHP 7, will get an error. Actually if you are installing php-curl in PHP 7, the package name should be;
sudo apt-get install php-curl
Not php5-curl
or php7-curl
, just php-curl
.
First thing to do : Check for the PHP Vesion your machine is running.
command Line :php -version
This will show something like this (in my case) :
PHP 7.0.8-0ubuntu0.16.04.3 (cli) ( NTS ) Copyright (c) 1997-2016 The PHP Group
if : you are using PHP 5.x.x => run command : sudo apt-get install php5-curl
if : PHP 7.x.x => run command (in may case) : sudo apt-get install php7.0-curl
Enable this extention by runing :
sudo gedit /etc/php/7.0/cli/php.ini
and in the file "php.ini": search for keyword "curl" to find this line Below and change it from
;extension=php_curl.dll
To:
extension=php_curl.dll
Next, save your file "php.ini".
Finally, In your command line restart your server by running : sudo service apache2 restart
.
Fire the below command it give list of modules
sudo apt-cache search php5-
Then file fire below command with module name to be install
sudo apt-get install name of the module
For reference link
I tried most of the above but it didnt work for my machine.ubuntu 18.04 but what worked for me is this.
first: check your php version
$ php-version
second: add your php version to the command ,mine was
$ sudo apt-get install php7.2-curl
lastly restart apache server
sudo service apache2 restart
although most person claimed that it not necessarily to restart apache :) thanks
Don't have to give version numbers. Just run sudo apt-get install php-curl. It worked for me. Don't forgot to restart the server. sudo service apache2 restart
Try this:
sudo apt-get install -y curl