Link to home
Create AccountLog in
Avatar of mcdnet
mcdnetFlag for United States of America

asked on

Fatal error: Call to undefined function curl_init()

I have been researching this problem for a few days now trying to get curl to work on a Windows 2003 Server running IIS.

PHP version 5.2.9 is running fine.  Website, and vBulletin message board running fine with php and mysql.

I have done every item I can find here at EE.

The php_curl is uncommented in the php.ini file.  I can run "php -m" without any errors, displayed below.

I uninstalled the "exe" PHP install that I had used originally and did a manual reinstall of PHP with the latest version from the website.

I have confirmed that both libeay32.dll and ssleay32.dll are in the C:\php folder.  I even went to the curl website and downloaded the latest version of the curl install exe file.

I have confirmed that both C:\php & C:\php\ext (my external path) are both defined in the PATH area of my server.

I can run PHPinfo and confirm that my ini file is in c:\php.  But I cannot determine any reference to Curl in the phpinfo page.

So I am not 100% sure it is installed correctly, but I know it can find the dll because I fixed the "cannot find module" error I was getting previously.

Can anyone confirm that curl will indeed run on a Windows 2003 server?  I am at a loss right now of what else to try.  I am not sure if I am just banging on a brick wall and should give up, or this should work and something somewhere is not set right.

Thank you for any assistance.
C:\Documents and Settings\Administrator>php -m
[PHP Modules]
bcmath
calendar
com_dotnet
ctype
curl
date
dom
event
filter
ftp
gd
hash
iconv
iisfunc
json
libxml
mssql
mysql
odbc
pcre
Reflection
session
SimpleXML
SPL
SPL_Types
standard
tokenizer
wddx
xml
xmlreader
xmlwriter
zlib
 
[Zend Modules]

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Ionut A. Tudor
Ionut A. Tudor
Flag of Romania image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of mcdnet

ASKER

Problem solved.
I deleted the 2 dll's out of the system32 folder and then copied in the dll's from my c:\php folder.  I do believe the 2 existing dll's were from older versions.  No surprising with all the various versions and installs I have been tried for days.
Rebooted the server and ran phpinfo and curl support now shows to be installed.
Being an obvious php noob, I was unable to get run the provided code.  I put it in a blank php, but it would just show me the provided code on the page.
But I am now able to run the vbulletin script on the server with no errors.
Thank you very much al3cs12.
Glad i was able to help,
Cheers
Avatar of mcdnet

ASKER

The only thing I might ask was to provide a bit more detail on how to try the code provided.  I tried it in a blank php page and it didn't run.  I am sure I am just not doing it right, but would like to know how.
The only thing I might ask was to provide a bit more detail on how to try the code provided. I tried it in a blank php page and it didn't run. I am sure I am just not doing it right, but would like to know how.
Just put the below code in your file, it should work

<?php
 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://google.co.uk/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$res= curl_exec($ch);
curl_close($ch); 
echo $res;
 
 
?>

Open in new window

Avatar of mcdnet

ASKER

So this code took me to Google.com without any errors.  I assume that if curl was having a problem I would get an error...correct?
Thanks again for the knowledge.
 
yes you would've get an curl_init undefined function error, If it took you to google.com it's working.
Cheers