Curl not working on localhost

Not sure if this is the right forum … but …

got apache/mysql/php installed on win 7 laptop.

all seems to be working ok - phpinfo() shows lots of info - and I can run php scripts localy.

problem is, I can’t use curl.

I’ve uncommented the

extension=php_curl.dll

line in php.ini but whenever I try to run the following script:

<?php
        // create curl resource
        $ch = curl_init();

        // set url
        curl_setopt($ch, CURLOPT_URL, "www.bbc.co.uk");

        //return the transfer as a string
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

        // $output contains the output string
        $output = curl_exec($ch);

        // close curl resource to free up system resources
        curl_close($ch);
?>

I get an error message:

Fatal error: Call to undefined function curl_init() in C:\\AServer\\Sites\\curltest.php on line 3

anyone help?

Does the .dll exist? Have you restarted Apache after enabling curl? Does the curl extension show up in phpinfo() ?

:slight_smile:

Verify the aspects suggested by previous poster.

In phpinfo() results, it will show which php.ini file is being used by Apache. You have to uncomment in the right php.ini file which is being used by apache ( verify it through phpinfo ).

If the above are correct, place the libeay32.dll and ssleay32.dll in apache’s bin directory. Restart the apache.

I remember trying to run cURL on WAMP once and read somewhere that it doesn’t come with it. You can install it yourself though.

Well, the file php_curl.dll ddn’t exist in my PHP folder so I downloaded it, restarted apache and tried again - no luck.

and no, curl doesn’t show up in phpinfo()

BUT … then I copied libeay32.dll & ssleay32.dll to Apache/bin, restarted Apache and …

Robert’s my father’s brother!

curl show up in phpinfo() and it WORKS!!

Thanks a lot.

try WAMP server, I use it and curl running normally

nah, don’t like WAMP at all, rather install and tweak myself … and shout when I get problems!

cheers.

Aaaargghhh!

I’m trying to get apache/mysql/php running on another, differnt win 7 laptop and I’ve got similar problems to the above …

… however, I’ve made the changes that I made on the other laptop but still no sign of curl on the second laptop!

I’ve checked that the php.ini version that apache is using is the corret one - it is

php_curl.dll is uncommented in the php.ini and it exists in my php/ext folder

I’ve copied libeay32.dll & ssleay32.dll to Apache/bin, restarted Apache and curl still doesn’t work … it doesn’t show up in the phpinfo()

any other ideas guys?

btw:

here are the php/apache versions from my phpinfo()

Apache Version Apache/2.2.16 (Win32) PHP/5.2.14
Apache API Version 20051115

anyone help?

Did you set the extension_dir value properly in php.ini? Try to set it like :
extension_dir=e:/phpdir/ext/ ( replace with your path )
restart apache and verify. If that is not working out, try to get a version of the apache that comes inbuilt with openssl.

Checked the ext dir, that’s fine.

Downloaded an apache with openssl … changed the config and setup as before … still no curl!

help!!

I wimped out in the end and installed wamp …