I have a Linux server with Ubuntu 16.04 installed. I usit just for LAMPP environment, I have PHP 5.6 installed (in apache and CLI), that because the project crash with PHP7, so, I have to maintain in 5.6 version. I'm trying to run a PHP script from the CLI, and I gets: curl_init() in unkown function. So, I went to the php.ini file (the one of the CLI) and unable the extension, but in CLI when I make: php --version
I get:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20131226/php_curl.dll' - /usr/lib/php/20131226/php_curl.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Then I tried to install curl with: sudo apt-get install php5-curl
but then I get:
E: Unable to locate package php5-curl
So, what should I do then? How can I install it?thanks
try running i have same issue solved by this command
sudo apt-get install php-curl
I got the same issue you need to add this repository
sudo add-apt-repository ppa:ondrej/php
sudo apt update
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:
1-> PHP 7.0: sudo apt-get install php7.0-curl
2-> PHP 7.1: sudo apt-get install php7.1-curl
3-> PHP 7.2: sudo apt-get install php7.2-curl
4-> PHP 5.5: sudo apt-get install php5.5-curl
5-> PHP 5.6: sudo apt-get install php5.6-curl
add this repository
sudo add-apt-repository ppa:ondrej/php
sudo apt update
select your php version 5.5, 5.6,7.0, 7.2
PHP 5.6: sudo apt-get install php5.6-curl
Test curl enabled or disabled
create index.php and add this code
echo 'Curl: ', function_exists('curl_init') ? 'Enabled' : 'Disabled';