0

I have curl installed and running on php for Apache2. On command line however it does not work:

$ php test.php
PHP Fatal error:  Uncaught Error: Call to undefined function curlhttp() 

checking for curl:

$ php -i | grep curl
/etc/php/7.0/cli/conf.d/20-curl.ini,
curl

having a deeper look:

cat /etc/php/7.0/cli/conf.d/20-curl.ini
; configuration for php curl module
; priority=20
extension=curl.so

where is the library anyway?

$ locate curl.so
/usr/lib/php/20151012/curl.so
/usr/lib/x86_64-linux-gnu/libcurl.so
/usr/lib/x86_64-linux-gnu/libcurl.so.3
/usr/lib/x86_64-linux-gnu/libcurl.so.4
/usr/lib/x86_64-linux-gnu/libcurl.so.4.4.0

which php version?

$ php -v
PHP 7.0.33-0ubuntu0.16.04.15 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.33-0ubuntu0.16.04.15, Copyright (c) 1999-2017, by Zend Technologies
    with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans

Let's check SO for a solution: How to install php-curl in Ubuntu 16.04

trying to reinstall:

sudo apt install php7.0-curl
Reading package lists... Done
Building dependency tree       
Reading state information... Done
php7.0-curl is already the newest version (7.0.33-0ubuntu0.16.04.15).
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

$ sudo apt install curl
Reading package lists... Done
Building dependency tree       
Reading state information... Done
curl is already the newest version (7.47.0-1ubuntu2.14).
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

I don't see the problem. What might be the cause and how can this be fixed?

merlin
  • 2,717
  • 3
  • 29
  • 59
  • if you output 'phpinfo()` from your cli, the `curl` extension is enabled and running? – William Prigol Lopes Jun 14 '20 at 19:22
  • Yes: $ php -r "phpinfo();": -> checking the file shows the entries: curl cURL support => enabled cURL Information => 7.47.0 I added the version info for PHP to the question. – merlin Jun 14 '20 at 19:26
  • What’s the curlhttp function? I didn’t hear about that one. – Mike Doe Jun 14 '20 at 19:37
  • ahhh.. you are right, that function is an old one I have in another file. Thought this was implemented native in PHP. That solve it I guess. Thank you. – merlin Jun 14 '20 at 19:41
  • Try `sudo aptitude install php-curl`. Otherwise possible mess between ini files and path – NVRM Jun 14 '20 at 20:06

0 Answers0