Jump to content

Trying to use libcurl with php and failing miserably!


claudiogc

Recommended Posts

Good evening!

I'm trying to use libcurl with php in my Debian and apparently it is not working unless i'm doing something wrong.

So, when i enter with "aptitude search libcurl", my output is:

 

 

v   libcurl-dev                     -                                           
p   libcurl-ocaml                   - OCaml curl bindings (Runtime Library)     
p   libcurl-ocaml-dev               - OCaml libcurl bindings (Development packag
v   libcurl-ocaml-dev-owsj4         -                                           
v   libcurl-ocaml-owsj4             -                                           
v   libcurl-ssl-dev                 -                                           
i A libcurl3                        - easy-to-use client-side URL transfer libra
p   libcurl3-dbg                    - debugging symbols for libcurl (OpenSSL, Gn
v   libcurl3-dev                    -                                           
i A libcurl3-gnutls                 - easy-to-use client-side URL transfer libra
v   libcurl3-gnutls-dev             -                                           
p   libcurl3-nss                    - easy-to-use client-side URL transfer libra
v   libcurl3-nss-dev                -                                           
v   libcurl3-openssl-dev            -                                           
v   libcurl4-dbg                    -                                           
v   libcurl4-dev                    -                                           
p   libcurl4-gnutls-dev             - development files and documentation for li
p   libcurl4-nss-dev                - development files and documentation for li
p   libcurl4-openssl-dev            - development files and documentation for li

The "i" means it is installed, i believe. Then, i read this tutorial and changed a little bit a code posted in it. http://php.net/manual/en/curl.examples.php

 

 

<?php

function cURLcheckBasicFunctions()
{
  if( !function_exists("curl_init") &&
      !function_exists("curl_setopt") &&
      !function_exists("curl_exec") &&
      !function_exists("curl_close") ) return false;
  else return true;
}

if( !cURLcheckBasicFunctions() ) {
    echo "UNAVAILABLE: cURL Basic Functions";
}
else {
    echo "cURL is working fine!";
}

?>

 

I believe if libcurl were installed in my system i should see "cURL is working fine", but my output is "UNAVAILABLE: cURL Basic Functions".

 

So, what is wrong?

libcurl is the OS/Debian curl package, you need to install and enable the PHP curl library in your php.ini and reboot the web server. I think debian calls it "php5-curl". You can see if it's enabled via phpinfo();

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.