简体   繁体   中英

Apache php: undefined call to curl_init()

I've problem implementing curl in my php-script. Apache2 server-log gives the following:

PHP Fatal error:  Uncaught Error: Call to undefined function curl_init()

I dont know how to solve it. I've made the following:

php.ini

uncommented the line

extension=curl

even tried with full path

extension=/usr/bin/curl

..

extension=/bin/curl

and even file extension ie

extension=curl.so

Even checked the system if I have php-curl

dpkg -l|grep -i curl

output:

ii  curl                                  7.64.0-4+deb10u1                            amd64         command line tool for transferring data with URL syntax
ii  libcurl3-gnutls:amd64                 7.64.0-4+deb10u1                            amd64        easy-to-use client-side URL transfer library (GnuTLS flavour)
ii  libcurl4:amd64                        7.64.0-4+deb10u1                            amd64        easy-to-use client-side URL transfer library (OpenSSL flavour)
ii  php-curl                              2:7.3+69                                    all          CURL module for PHP [default]
ii  php7.3-curl                           7.3.19-1~deb10u1                            amd64        CURL module for PHP

How could it be solved?

Also checked php configuration through

phpinfo();

according to:

Apache/PHP undefined function curl_init()

But no such section about curl is residing in it

YES - I know this question has been asked several times, mostly for windows, and by now I cannot find any solution. If you consider this a duplicate, please help me with a link to a really good answer. I've checked and keep checking but by the moment I cannot find any appropriate solution I've tried the answer of some of the links

It seems like the PHP instance you are running does not read the php.ini file you have updated to include curl.

Did you try running php_ini_loaded_file() to figure out which file exactly is loaded from disk to use as PHP configuration? ( https://www.php.net/php_ini_loaded_file )

In some environments (if not most) PHP can run from different configurations (eg webserver or commandline) and they can all have their own php.ini configuration. If you find the correct ini file, restart the webserver again before verifying the new configuration via phpinfo().

You can also run php --ini from the commandline to see which ini files are used there.

Update, more info on my suggestion can be found here: php.ini: which one?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM