Update WAMP/Apache to use new cacert.pem - php

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

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

PHP include path and EasyApache 4 - need changing?

We recently just updated to EasyApache 4 and from what I am told things are no longer really stored in /usr/local/lib/php, but rather in /opt/cpanel/{version-number}.
Now, before the upgrade we had an include path in the php.ini that included both /usr/lib/php and /usr/local/lib/php.
My question is, should I now add /opt/cpanel/{version-number} to this and remove the aforementioned or is there another way this should be handled?
Your php.ini file should be in /opt/cpanel/ea-php{version-number}/root/etc/
If you don't specify include_path, it will default to:
.;/path/to/php/pear
If you want to specify it, and you want to include PHP's folder, then it should be fine to include:
/opt/cpanel/ea-php{version-number}/
EasyApache4 shouldn't change this for you automatically.
If you upgrade PHP, you can test it in parallel with a staging subdomain before you upgrade your main subdomains. And, while you test, you just need to make the new php.ini file similar to your current PHP version's php.ini, with the difference that you put the correct include_path for the new PHP version.
In summary, you just need to update your php.ini only when you upgrade a major version of PHP. Until then, you don't need to make any changes to php.ini.

Change php configuration file in PhpStorm

I have installed WAMP server on my computer and tried to configure the PHP Interpreter in PhpStorm but it keeps pointing to the wrong php.ini file.
How can I change it to the correct one?
Let me know if you need more information.
Edit
The place where php.ini that WAMP tells me to edit is C:\wamp64\bin\apache\apache2.4.17\bin\php.ini
The one that PhpStorm is pointing to has a big DO NOT EDIT label on it.
If this is for a website you are attempting to write then you need to point your Configuration File at
C:\wamp\bin\apache\apache{version}\bin\php.ini
NOTE
There are PHP ADDONS provided for PHP7 that will install into the existing WAMPServer 3.0.x and the latest is PHP7.0.8 found here or from SourceForge
I had the same problem, and I backed up the original php.ini content inside bin\php\php7.0xxx folder, and I replaced the content with the php.ini inside C:\wamp\bin\apache\apache{version}\bin\php.ini, and then restarted phpstorm and it worked.

PHP cURL error code 60

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.

Cannot get browscap to load on OSX no matter which version I use or where I put it

I am trying to get the following code to run:
$browser = get_browser(null, true);
print_r($browser);
The error that I get is as follows:
Warning: get_browser() [function.get-browser]: browscap ini directive not set in /Applications/XAMPP/xamppfiles/htdocs/series/firstfile/index.php on line 3
I am running OSX 10.8.4 with XAMPP. The browscap info in my php.ini file is as follows:
[browscap]
;browscap = /Applications/XAMPP/xamppfiles/etc/browscap.ini"
I have also tried the following paths:
/Macintosh HD/Applications/XAMPP/xamppfiles/etc/browscap.ini
I downloaded and placed the browscap.ini file myself into that directory and have also tried referencing it from other locatations in case it was a permission issue or something.
I am assuming that the problem is with how I write my path but I just cant find a way to get XAMPP to accept it and when you go to phpinfo() it is listed under 'core' as browscap - no value.
Obviously I have been restarting Apache etc. with each change to ensure that the php.ini is refreshed.
All of the information I can find seem to pertain to Windows rather than Mac so I am struggling!
I wonder what kind of valuable information you expect to get from this function.
But whatever it is, please be advised that it is considered bad practice, because you are essentially practicing server based client sniffing, and the only base of information is the user agent string, which can be anything and does not need to represent the real situation. Also, information like "javascript" can only represent the coded ability of the client, not the current configured abilities, which can be less.
If you still think the function to be of any use, you have to solve the task of getting a copy of that "browscap.ini" file this function wants to use, and you have to constantly update this file to include new browser versions.
There is a link to a file source on the documentation page of get_browser(). Download a file and point the INI setting to that location. Make sure to activate it by removing the semikolon.
I gave you the instructions to solve your problem,I think this will help you. your file path was absolutely right but you forgot to remove the semicolon and the double quotations mark [browscap]
;browscap = /Applications/XAMPP/xamppfiles/etc/browscap.ini"
download the file by clicking the link and put it in the file path which I explains you below
http://tempdownloads.browserscap.com/stream.asp?PHP_BrowsCapINI
Yeah, it seems XAMPP on Mac OSX installs differently, and you don't specify the root directory. First, find the file 'php.ini' installed in the following location: /Applications/XAMPP/xamppfiles/etc/php.ini Second, 'php.ini' is write protected in this location, so copy it to desktop thus allowing you to alter it. From desktop open in TextEdit and look for text reading '[browscap]' (we'll come back to this). Third, download a copy of file 'php_browscap.ini' from the Browser Capabilies Project.
Mac OSX (cont.) Fourth, change filename from 'php_browscap.ini' to 'browscap.ini'. Place a copy in the following location:** /Applications/XAMPP/xamppfiles/etc/extra/browscap.ini Fifth, now go back and update file 'php.ini' with the new location of 'browscap.ini' to read as follows: [browscap] browscap = /Applications/XAMPP/xamppfiles/etc/extra/browscap.ini Sixth, save 'php.ini' and copy from desktop back into original location: /Applications/XAMPP/xamppfiles­/etc/php.in
Seventh, restart XAMPP. ** Note: I think the location of 'browscap.ini' may be somewhat arbitrary. What seems most important is the pathname that is listed in file 'php.ini' under [browscap] (in my case, browscap = /Applications/XAMPP/xamppfiles­/etc/extra/browscap.ini). Good luck fellow Mac XAMPP users!

Categories