6

I installed PHP 7 to my server (as a result, I have not /etc/php5 and /etc/php/7.0). When I run my web app, I cant see any of my previous CURL (or fork).

at first I got this err msg:

Message: Call to undefined function curl_init()

and after installing php7-curl i get it enabled - approved on info() function and this test code:

var_dump(_isCurl());
function _isCurl(){
    return function_exists('curl_version');
}

returning TRUE.

but when having an actual CURL in my code I get this error:

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

in /usr/lib/php/20151012/ i have only .so files which doesn't make sense. (same goes for the /usr/lib/php5/20131226 folder). So what is it trying to get and why from there?

how can I configure my new php.ini file to get the previous model settings? (if possible with the enabled PCNTL_FORK too) How can I make it work with curl? what the hell happened???

EDIT 04.05.2016:

Ok, i decided to change it to curl.so and now got this msg PHP Warning: Module 'curl' already loaded in Unknown on line 0 and then I disabled it, and somehow, curl now is working (commented curl ;extension:curl.so and ;extension:php_curl.dll. What the hell.

Martijn
  • 15,791
  • 4
  • 36
  • 68
Imnotapotato
  • 5,308
  • 13
  • 80
  • 147
  • Do you want to have both versions at the same time? – Álvaro González May 03 '16 at 15:58
  • well, no, but I do want to keep the old settings from the php.ini :X. – Imnotapotato May 03 '16 at 16:00
  • Is this what you're going to suggest? `root@YHserver:/usr/lib/php5/20131226# sudo a2dismod php5 Module php5 already disabled` doesn't work... – Imnotapotato May 03 '16 at 16:03
  • 2
    Having a .dll (windows!) file on a linux server doesn't make sense. Change the php_curl.dll to curl.so (or php_curl.so, whatever the file is called) and try again – Elias Van Ootegem May 03 '16 at 16:03
  • I'm not suggesting anything. Your question states *I have not /etc/php5 and /etc/php/7.0* which is rather confusing and you appear to be loading libraries from different versions. I simply didn't know what you were trying to do. – Álvaro González May 03 '16 at 16:05
  • you have to change the file reference from .dll to .so. Moreover, i had the same problem and i had to delete the php module and reinstall them, because i had some of them in php5.6 (and it wasn't detected automatically). – Unex May 03 '16 at 16:16
  • @Unex so what do you suggest doing? completly remove php7 and install it again (`sudo apt-get --purge remove ...` )? – Imnotapotato May 03 '16 at 16:37
  • run phpinfo() and see what is installed. – Misunderstood May 03 '16 at 16:59
  • no php7 is probably ok. Just remove the curl extension and install the new version. Apt-get probably didn't get that version mismatched. – Unex May 03 '16 at 18:37
  • Ok, i decided to change it to `curl.so` and now got this msg `PHP Warning: Module 'curl' already loaded in Unknown on line 0` and then I disabled it, and somehow, curl now is working (commented curl `;extension:curl.so` and `;extension:php_curl.dll`. What the hell. – Imnotapotato May 04 '16 at 10:10

4 Answers4

15

I had this exact problem.

I have just spent the last few hours trying to fix some stuff and in my haste I for some reason enabled this line:

extension:php_curl.dll

Obviously, that makes 0 sense, as someone said but the error message is weird after you do that. Running apt-get dist-upgrade DID NOT solve the problem.

So, after pulling out some more hair and re-reading this post a 100 times, I just commented it back out

;extension:php_curl.dll

and ya, problem solved.

So the OP must have done what I did... drink beer while working

Necoras
  • 6,743
  • 3
  • 24
  • 45
className
  • 151
  • 1
  • 2
7

running apt-get dist-upgrade fixed all the problems :)

Imnotapotato
  • 5,308
  • 13
  • 80
  • 147
3

On my case, to get curl working :

  • sudo apt-get install php-curl
  • comment curl extension : ;extension=php_curl.dll in php.ini (eg /etc/php/7.1/cli/php.ini)
Remy Mellet
  • 1,675
  • 20
  • 23
0

Settings might get mixed up when two versions of PHP being installed at the same time -- for example, 7.0 and 7.3. This can be because a recent dist-upgrade. The wrong version of the module might get loaded. In my case, apt purge php7.0 and a reinstall of 7.3 fixed me up, of course you might not want to be as heavy-handed with your own system...

mangrove
  • 31
  • 2