PHP cURL error code 60 - php

Whilst trying to setup a php environment on windows (using wamp) to use the Amazon PHP SDK, when i try to run a sample test I get the following error:
Fatal error: Uncaught exception 'cURL_Exception' with message 'cURL resource: Resource id #10; cURL error: SSL certificate problem: unable to get local issuer certificate (cURL error code 60). See http://curl.haxx.se/libcurl/c/libcurl-errors.html for an explanation of error codes.' in C:\wamp\www\AWSSDKforPHP\lib\requestcore\requestcore.class.php on line 848
I have already added the following line to my php.ini
curl.cainfo = C:\Windows\ca-bundle.crt
which is the location of a certificate i created using this VBS script
VBS-Script
I have restarted my WAMP service also.

Use this certificate root certificate bundle:
https://curl.haxx.se/ca/cacert.pem
Copy this certificate bundle on your disk. And use this on php.ini
curl.cainfo = "path_to_cert\cacert.pem"

i fixed this by modifying php.ini file at C:\wamp\bin\apache\apache2.4.9\bin\
curl.cainfo = "C:/wamp/bin/php/php5.5.12/cacert.pem"
first i was trying by modifying php.ini file at C:\wamp\bin\php\php5.5.12\ and it didn't work.
hope this helps someone who is searching for the right php.ini to modify

php --ini
This will tell you exactly which php.ini file is being loaded, so you know which one to modify. I wasted a lot of time changing the wrong php.ini file because I had WAMP and XAMPP installed.
Also, don't forget to restart the WAMP server (or whatever you use) after changing php.ini.

#Overflowh I tried the above answer also with no luck. I changed php version from 5.3.24 to 5.5.8 as this setting will only work in php 5.3.7 and above. I then found this http://flwebsites.biz/posts/how-fix-curl-error-60-ssl-issue I downloaded the cacert.pem from there and replaced the one I had download/made from curl.hxxx.se linked above and it all started working. I was trying to get paypal sandbox IPN to verify. Happy to say after the .pem swap all is ok using curl.cainfo setting in php.ini which still was not in 5.3.24.

#Hüseyin BABAL
I am getting error with above certificate but i try this certificate and its working.
https://gist.github.com/VersatilityWerks/5719158/download

First, we need download this certificate root certificate bundle:
https://curl.haxx.se/ca/cacert.pem
Move this file to somewhere such as to PHP folder in Wamp/Xampp folder.
Then edit your "php.ini" :
curl.cainfo ="C:/path/to/your/cacert.pem"
and
openssl.cafile="C:/path/to/your/cacert.pem"
IMPORTANT:
Be sure that you open the "php.ini" file directly by your Window Explorer. (in my case: “C:\DevPrograms\wamp64\bin\php\php5.6.25\php.ini”).
Don't use the shortcut to "php.ini" in the Wamp/Xampp icon's menu in the System Tray. This shortcut didn't work in some cases I faced.
After saving "php.ini" you don't need to "Restart All Services" in Wamp icon or close/re-open CMD.
Try with " var_dump(openssl_get_cert_locations()); "
and look at line :
["ini_cafile"]=>
string(40) "C:/path/to/your/cacert.pem"
Done.

Problem fixed, download https://curl.haxx.se/ca/cacert.pem and put it "somewhere", and add this line in php.ini :
curl.cainfo = "C:/somewhere/cacert.pem"
PS: I got this error by trying to install module on drupal with xampp.

Add the below to php.ini [ use '/' instead of '\' in the path]
curl.cainfo= "path/cacert.pem"
Restarted my XAMPP. It worked fine for me. Thanks

The easiest solution to the problem is to add the below command in the field.
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
Using this will not need to add any certificate or anything.

if cacert.pem from above links doesn't working try this one worked for me
https://gist.github.com/VersatilityWerks/5719158/download

First you have to download the certificate from this link
https://curl.haxx.se/ca/cacert.pem
and put it in a location you want
the name of downloadable file is : cacert.pem
So in my case I will put it under C:\wamp64\bin\php\cacert.pem
Then you have to specify the location of the php.ini file
For example, I am using php 7 the php.ini file is located at :
C:\wamp64\bin\php\php7.0.10\php.ini
So access to that file and uncommit this line
;openssl.cafile
also update it to be looks like this
openssl.cafile="C:\wamp64\bin\php\cacert.pem"
Finally restart your apache server and that's all

IMPORTANT: after 4 hours , working with laravel 5.7 and php 7.+ and run/use php artisan serve
on localhost trying to connect to mailgun.
IMPORTANT to resolve the problem do not work with IP http://127.0.0.1:8000
use localhost or set domain name by host file.
ok ,

The solution is to edit the file php.ini located in your php version(for me it's php7.0.10)
not the php.ini of apache. You will find a commented file like this ;curl.cainfo
Just change this line like this curl.cainfo = "C:\permCertificate\cacert.pem"
Don't forget to create the "permCertificate" directory and copy the "cacert.pem" file inside it.

Related

How to enable CurlHttpClient for WAMP in PHP 7.4+?

I'm trying to open the index_dev.php file for a site on my Wampserver and I'm getting this error:
Internal Server Error - PHP Warning - Configure the "curl.cainfo", "openssl.cafile" or "openssl.capath" php.ini setting to enable the CurlHttpClient
I tried to do some research on how to enable curl on WAMP, but all of the info I was seeing was for PHP 5.x
As far as configuring, I don't have a clue what I should do to the "curl.cainfo", "openssl.cafile" or "openssl.capath" settings in my php.ini files.
Thanks in advance for your help!
Go to https://curl.se/docs/caextract.html and download the latest .pem file.
Copy the .pem file to ..... well I put mine in C:\wamp64\bin\php called cacert.pem
This contains a whole bunch of certificates and because the file is created by Mozilla we sort of trust it.
Now using the WAMPManager, edit your current php.ini file by
left click wampmanager -> PHP -> php.ini
Find this parameter, it will be commented out with a ;
;openssl.cafile=
Change it to
openssl.cafile="c:/wamp64/bin/php/cacert.pem"
Save the edit, and then restart Apache to activate the change

Phpmyadmin is not opening in wamp server

Cannot load mysqli extension. Please check your PHP configuration
I have already remove; from the line ;extension=php_mysqli.dll
in php.ini file . Still, nothing has been changed.
nothing change has been showing me.
Even i have reinstall wamp , restrat laptop as well.
Does any updation in a laptop can cause this? because yesterday i have updated.
As per my understanding you are trying to load mysqli extension to your local server.
Follow these steps.
1) Create file called phpinfo.php in c:\wamp\www and paste the following code in it.
<?php phpinfo(); ?>
2) Run the file in browser i.e localhost/phpinfo.php you will be getting complete configurations that your server has.
3) Go to php.ini file in your server and remove ;extension=php_mysqli.dll semicolon and save the file.
4) Restart WAMP server and PhpMyAdmin try to load localhost/phpmyadmin.
Hope this helps...!

phpmyadmin error with sanitizing.lib.php

I am having a problem getting phpmyadmin to work correctly on my desktop. Every time I try running phpmyadmin, I get the following error:
Fatal error: Call to undefined function __() in C:\Apache24\htdocs\phpMyAdmin\libraries\sanitizing.lib.php on line 135
I was wondering if anyone has advise on how to make phpmyadmin work correctly. I have Apache v2.4.1.8, php v5.5.33, and phpMAdmin v4.6.0 installed and according to the tutorials I followed, everything works correctly until I get to the phpMyAdmin.
If you need any other info, I will reply what I can.
This is a permissions error.
You need to
Go into php.ini file and make sure extension=mbstring.dll is enabled.
Restart your webserver.
In the newest php versions the "extension_dir" path is not enabled initial. So maybe it helps... :)
screenshot
In addition to making sure extension=mbstring.dll is enabled, you should make sure the extension path is correct.
By default, the extension path is set "/ext" in the php.ini file.
However, when install httpd as a service, the relative path may be incorrect.
So, you should edit the extension path to an absolute path, such as "C:\Program Files\PHP\v5.6.21\ext".

Update WAMP/Apache to use new cacert.pem

Updated CA Cert: http://curl.haxx.se/ca/cacert.pem
I know I've done this on another machine but I can't find the resources that I found before when I had to perform this.
I want to update WAMP to use the .pem above, but I can't for the life of me remember where to do that with what command.
If you're running at least php 5.3.7, you can put this in the ini at the end of your php.ini file:
curl.cainfo=c:\path\to\cacert.pem
You'll need to find the specific php.ini file for the version of php one you've selected to use.
A comment in the doc's show this: http://php.net/manual/en/function.curl-setopt.php
Here's the doc with the specific setting: http://php.net/manual/en/curl.configuration.php

How do I get php curl to run on my apache2.x Development server?

Before I begin, I will add that I've spent much time googling this and have attempted several solutions none of which have worked.
System Info:
Windows 7 Professional (x86, 32 bit )
Apache2 up and running C:\Program Files\Apache Software Foundation\Apache2.2\
PHP 5.3.8 C:\Program Files\PHP Also works.
manually configured httpd.conf to enable php, note that php is working, except for curl.
I have enabled curl in my php.ini C:\Program Files\PHP\php.ini
This is near the end of my php.ini
[PHP]
extension_dir = "ext"
[PHP_CURL]
extension=php_curl.dll
Note also that the file C:\Program Files\PHP\ext\php_curl.dll exists!
I have restarted the apache server and yet curl still does not function.
a quick test.php file:
<?php
$curl_conn = curl_init();
?>
note that I have both php start and end tags correct stackoverflow just isn't showing the start php tag.
puts out:
Fatal error: Call to undefined function curl_init() in E:\path\to_project\test.php on line 3
I have now spent 3 hours trying to get curl to work, google has no helped, most of the solutions seem to involve making sure that the extension=module line in php.ini is not commented out, and as you can see above it is not commented out so that advice doesn't seem to help me.
Any ideas would be appreciated as this is rather frustrating.
Thanks!
You should add "C:\PHP" to the server's PATH environment variable:
Right-click on My Computer, choose Properties
Flip to the Advanced tab
Click the Environment Variables button
Double-click the Path variable in the list of System variables.
Either add "C:\PHP;" to the beginning or ";C:\PHP" to the end (sans quotes, not both).
Restart your computer for it to take effect.
Thanks to:
http://www.webcheatsheet.com/PHP/install_and_configure.php
I know this thread has long been closed, but for anyone like myself who encounters this problem subsequently, for me, the answer turned out to be a DIFFERENT copy of the php.ini file was being loaded than what I thought. I was editing the php.ini file in my PHP 5.4.3 directory, and there is another copy of the php.ini file that resides in the Apache directory - identical as far as I could tell from a quick glance.
De-commenting the extension=php_curl.dll line IN THE RIGHT FILE, the Apache folder, enabled the curl function for me.
Jeff S.
Have you copied cURL dependency files:
libeay32.dll
ssleay32.dll
to C:\Windows\System32 folder?
It could be that PHP cannot find these two files to run cURL extension.

Categories