Enable CURL on Windows For PHP5.6.4 - php

Im trying to use HybridAuth in one of my projects, the error message im getting is
Original error message: Hybridauth Library needs the CURL PHP extension.
Even though i have enabled cURL in my php.ini
extension=php_curl.dll
here is a screenshot of my phpinfo()
What else i have to do in-order to enable the cURL extension, the related php_curl.dll is also present in the ext dir
Message that i get when i restart the apache server
C:\Apache24\bin>httpd -k restart AH00558: httpd: Could not reliably
determine the server's fully qualified domain name, using
fe80::a02e:1c05:c6ad:9332. Set the 'ServerName' directive globally to
suppress this message

You have to add PHP install path to windows environment path. For example it you install php on C:\PHP, add both C:\PHP and C:\PHP\ext to windows path. Some how Apache cannot find curl dependencies libeay32.dll, ssleay32.dll and libssh2.dll

Try this:
if (in_array ('curl', get_loaded_extensions())) {
echo "cURL is installed on this server";
}
else {
echo "cURL is not installed on this server";
}
See, if that works.

so it turns out i need a fixed version of curl which i could not find for PHP_5.6.4, so i downgraded to PHP Version 5.4.3 and then downloaded Fixed curl extension(dont know what it is) from here replaced the original php_curl.dll with the one i downloaded and voila it worked.
The following SO post helped me fix the problem
PHP cURL not working - WAMP on Windows 7 64 bit
P.S please feel free to edit the answer as i dont know the exact reason why its working now and why it was not earlier...

get back the original php_curl.dll file ( from the zip file you downlaoded from php.net )
copy libssh2.dll, php_curl.dll, ssleay32.dll, libeay32.dll to Windows\system32 folder
this worked with me i have php 5.6.6 x64 ts with apache 2.4.10 in windows 8.1

You have to add the PHP install path to the Windows environment path. For example, if you install PHP on C:\PHP, add both C:\PHP and C:\PHP\ext to the Windows path. Somehow, Apache cannot find curl dependencies libeay32.dll, ssleay32.dll and libssh2.dll.

Related

Not able to install pThread on Windows Xampp

Update: Looks like I am not doing anything wrong here. When I execute a thread example, it works fine. I am not sure, then why am I getting those errors when I start Apache.
Any ideas?
I am trying to install pThread on Xampp (Windows 7) as follows:
My PHP version information: 5.4.7 VC9 x86
I have downloaded php_pthreads-0.0.45-5.4-ts-vc9-x86.zip
Then I added pthreadVC2.dll to C:\xampp\php and php_pthreads.dll to C:\xampp\php\ext
In php.ini, I have added extension=php_pthreads.dll
Restarted Apache server and received following error:
Any suggestions on why this is not working?
I do not use Windows, but according to the people commenting in the manual, you must also add:
LoadFile "C:/xampp/php/pthreadVC2.dll"
to your httpd.conf (httpd-xampp.conf the manual mentions)
Here is what I did and works for me:
Check your PHP's compiler version using phpinfo() as you have already done. Mine and your both is VC9
Download and install proper Pthread package that matches your compiler version. I downloaded "php_pthreads-0.0.45-5.4-ts-vc9-x86.zip" file. Make sure your OS version also mathes (32-bit or 64-bit).
Extract Zip file in a temp folder
Copy php_pthreads.dll to the 'bin\php\ext\' folder
Copy pthreadVC2.dll to the 'bin\php\' folder
Copy pthreadVC2.dll to the 'bin\apache\bin' folder
Copy pthreadVC2.dll to the 'C:\windows\system32' folder
Open php\php.ini and add "extension=php_pthreads.dll" without quotes at the end of file
Restart server and you won't get any error message.
Good luck
copy "pthreadVC2.dll" file to "windows/system32" directory.then restart apache. It worked for me.

php curl works from cli but not from apache

I can't get cURL to work from inside Apache by any means. It's actually fairly strange too provided that:
I can execute my PHP pages from the CLI and it POSTs my requests perfectly fine
When I look at my error logs, I get "PHP Fatal error: Call to undefined function curl_init()" as if the extension isn't installed at all. Similarly, a quick `phpinfo()` also yields such as if the extension isn't installed.
Additionally, when I built PHP, I opted the "--enable-curl" flag.
You are probably not loading the extension in the appropriate php.ini. The file should include something like:
[PHP_CURL]
extension=php_curl.dll
Also, --enable-curl is not a PHP configure option. --with-curl=[DIR] is the one you'd want. Check out the cURL installation instructions.
php_curl.dll should be inside PHP's ext directory when configured correctly.
I had same problem after installing php5-curl. I rebooted apache and that fixed it.
sudo /etc/init.d/apache2 restart for ubuntu 12.04
I had similar problem - worked from cli, silently failed from Apache 2.4
I've tried:
1) copying ssleay32.dll and libeay32.dll from php folder into apache\bin folder - didn't work
2) deleting ssleay32.dll and libeay32.dll from apache\bin folder completely - WORKED.
You should restart apache server each time you make change to make it work.
Also you should install both x86 and x64 versions of C++ Resistributable Visual Studio from Microsoft.

installing php cURL on IIS

I cannot install PHP-CURL on IIS. I think I have tried everything.
My phpinfo() output does not list cURL as available.
I have C:\PHP in my path and working correctly.
I have edited the registry to read from C:\PHP\php.ini. phpinfo() output shows the correct .ini path loaded.
I have uncommented 'extension=php_curl.dll'
I have ssleay32.dll and libeay32.dll availble in C:\PHP
Windows Server 2003
IIS 6
PHP 5.2.4
Try running:
php-cgi.exe -v
and see if any errors come up.
Also make sure the php is correctly in your path by going to the command line and typing:
echo %PATH%
As well make sure the php_curl.dll is in the correct directory and that ssleay32.dll and libeay32.dll are the same versions.
If all else fails try reinstalling PHP as I remember there being some issues a while back with the Curl Module not working on 5.1.4.
As well someone else mentioned installing the thread safe PHP package versus the non-thread package resolving a similar issue.
Did you definitely put php_curl.dll in the directory that PHP reads extensions from? Are the file permissions on it ok? And the big question: where did you get the php_curl.dll from? If you got a precompiled one it might be compiled for a different version of PHP than you are running. Check your webserver logs and see what comes up from PHP when you restart the server/container/whatever.

How to get CURL to work with PHP on Windows? (WAMP)

Update: The problem appears to have been corrupt DLLs somewhere in my PHP installation, or possibly a bug in PHP 5.2.9 on Win2k. I downloaded the windows (binaries-only) distribution of PHP 5.2.10 from php.net and extracted that to my c:\PHP directory. After doing that, everything worked fine.
Update2: I undid everything that I tried earlier (everything from the bulleted list below), except that I left "extension=php_curl.dll" uncommented in my php.ini file. It turns out that is all you should have to do in a proper installation.
I'm trying to get CURL to work on a Windows installation of PHP (version 5.2.9-2), and I am at wit's end. I have found the PHP CURL installation page, this SO question which references this page, and this SO question. I've tried most of the suggestions in all of those pages but I still get an error. Here is my very simple test page:
<?php
$ch = curl_init();
?>
<b>Success!</b>
This gives me:
Fatal error: Call to undefined function curl_init() in C:\ApacheRoot\curltest.php on line 2
In my Apache error log I get this each time the server starts:
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\PHP\\ext\\php_curl.dll' - The specified procedure could not be found.\r\n in Unknown on line 0
I have done the following:
Uncommented the following line in php.ini: extension=php_curl.dll
Copied ssleay32.dll and libeay32.dll from C:\PHP to C:\WINNT\System32
Downloaded cURL for Win32 from curl.haxx.se and extracted the .zip file to C:\cURL
Added C:\cURL to my system PATH environment variable.
Verified that:
php.ini includes extension_dir="C:\PHP\ext"
The directory C:\PHP\ext contains php_curl.dll
The only php.ini file on my system is in C:\PHP (i.e. especially that there is no C:\WINNT\php.ini)
The Apache httpd.conf file includes the line PHPIniDir "C:/PHP/"
I have also rebooted the machine (several times, in fact...).
You don't have to reboot the computer, just restart the apache and the php module will read the new ini.
Did you change the correct php.ini? In case of doubt
<?php echo 'php.ini: ', get_cfg_var('cfg_file_path'); ?>
can tell you.
Is there something in the error.log of the apache that indicates that something went wrong while loading php and the php_curl.dll?
Did you start the apache as a win32 service? If you did try to start it as a console application. Error messages will show up on the console then. Or start it as a service and take a look at the error.log file and the windows event log (start, run, eventvwr.msc /s).
edit:
"The specified procedure could not be found"
You need a dll that is compatible with your php version and build. Exactly what did you install and where did you get it from?
Try this:
Stop WAMP completely.
Find your WAMP folder: C:\Path\To\WAMP\bin\Apache\ApacheVersion\bin\
Edit that php.ini and uncomment extension=php_curl.dll
Restart WAMP.
That should hopefully solve it.
*EDIT: Do the same thing # C:\Path\To\WAMP\bin\php\PHPVersion\
This is what worked for me
Answered by Soren from another SO thread - CURL for WAMP
"There seems to be a bug somewhere. If you are experiencing this on Win 7 64 bit then try installing apache addon version 2.2.9 and php addon version 5.3.1 and switching to those in WAMP and then activating the CURL extension. That worked for me."
This fixed it for me:
Go to here:
http://www.anindya.com/php-5-4-3-and-php-5-3-13-x64-64-bit-for-windows/
Download 'php_curl-5.3.13-VC9-x64.zip'
Stop WAMP Server from Running
Extract the file 'php_curl.dll'.
On your local machine, browse to (or where your WAMP installation is found) c:\wamp\bin\php\php5.3.13\ext
Rename php_curl.dll to php_curl.dll.old (or whatever you choose) and then copy the new file into the above directory.
Restart WAMP Server
All should be working ok now.
I had the same problem with php-5.5.26-Win32-VC11-x64 (on Windows) and I tried everything listed here with no luck. Finally I got it working by adding PHP installation directory to windows Path.
With PHP 5.6.9 on Windows Server Core 2012 x64 cURL was not working, not showing up in phpinfo despite uncommenting php_curl.dll extension in my php.ini and restarting the Apache 2.4 service. Added the php path and the php\ext path to my $evn:path. No joy.
Fix: I didn’t need to download any other php_curl.dll file and couldn’t find one for PHP 5.6 anyway. What finally worked was to copy these three files into the Apache24\bin folder then restart Apache:
libeay32.dll
libssh2.dll
ssleay32.dll
Copying these to System or System32 was not needed.
If the problem persists after you uncomment the module from both php.ini files (that people are already talking about and which are located on apache folder and php folder) and even after you check that you got the php_curl.dll ** at
C:\WAMP\bin\php\php5.3.13\ext
YOU SHOULD TRY TO REPLACE THE ORIGINAL DLL THAT COMES WITH WAMPSERVER with one from this website:
http://www.anindya.com/php-5-4-3-and-php-5-3-13-x64-64-bit-for-windows/
My problem was there!
Hope it helps.

php cURL iis 6.0 windows server 2003

I am having an issue setting up cURL with IIS 6.0, Windows Server 2003, PHP 5.2.6
I have installed to C:\PHP
set PHPRC = C:\PHP\php.ini
copied ssleay32.dll and libeay32.dll to C:\PHP
in php.ini, uncommented the line
extension=php_curl.dll
extension_dir="C:\PHP\ext"
c:\php\ext has the dll php_curl.dll
C:\PHP is in PATH
still getting
Fatal error: Call to undefined function curl_init()
Make sure php_curl.dll is in the directory listed under "extension_dir" in php.ini. If it is already, try restarting IIS (Apache always needs a restart from me when making php.ini changes).
EDIT 1:
Try opening up a command prompt to c:\php and running:
php -c . -i | find /i "curl"
Does it come back with any output? If so, IIS is using the wrong php.ini file.
EDIT 2:
Is c:\php in your PATH? You can check with "echo %PATH%" from the command prompt.
i ended up doin a reinstall of php, then unistalling php. then i copied and extracted the thread safe php package into c:\php rather than using the non thread safe package
Maybe it's loading c:\windows\php.ini?
I take it you've restarted IIS since you changed the config... :)

Categories