3

I 've upgrade my ubuntu to 18.04 and now I miss my curl.so.

Normally it would be here /usr/lib/php/20160501/curl.so but it is gone.

On the command line I can use curl but not in my php code.

php -m | grep curl leads to

PHP Warning:

    PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/20160303/curl.so' - /usr/lib/php/20160303/curl.so: cannot open shared object file: No such file or directory in Unknown on line 0    

A quick fix would be to just place "a" curl.so in that folder but where do I get a curl.so?

I tried to reinstall it with apt install php-curl but that gives me

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php-curl : Depends: php7.2-curl but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I'm still using ppa:ondrej/php.

When I check /var/lib/php/7.1/enabled_by_admin curl is listed.

In my /etc/php/7.1/cli/mods_available curl.ini is there.

And in my /etc/php/7.1/cli/conf.d the symlink to that ini is also there.

wget https://curl.haxx.se/download/curl-7.59.0.tar.gz
cd curl-7.59.o
./configure
make
sudo make install

also didn't help.

3 Answers 3

6

First I freshly added the ppa and reinstalled php7.1

sudo apt-add-repository ppa:ondrej/php
sudo apt-get update
sudo apt install php7.1

Than I installed php7.1-curl and voila all works perfectly fine again.

The problem was that I got old ppa version.

2

This works in Ubuntu 18.04 bionic beaver version

Type this command to remove all curl packages in the system

sudo apt-get purge curl

Then type this command to install the latest php version which is php7.4.5

sudo apt-get install php7.4

Finally type this command to install the latest php curl

sudo apt-get install php7.4-curl
2
  • 1
    Thank you, this is what I needed! Mar 17, 2022 at 3:55
  • Thanks this problem was a nightmare, had to dist upgrade from 16.04 to 18.04 first, then re-add ppa:ondrej/php (despite already having it in 16.04) then finally php7.4-curl can be found.
    – malhal
    Jan 21, 2023 at 12:10
1

This worked for me:

sudo apt-get install curl

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .