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?

Edited by claudiogc
Link to comment
Share on other sites

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();

Edited by CroNiX
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.