I have a php file that i want to pars something from wiki.
The code is:
file_get_contents("https://en.wikipedia.org/w/api.php?format=json&action=parse");
I constantly get the error:
file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP?
By searchin google I finde a lot of commets telling "you have to activate or uncoment openssl_extension in wamp."
This is clearly activated:
SEE Screenshot that proofs this is activated
Can someone help me to get rid of this error?
Create a file called phpinfo.php and put this in it:
<?php phpinfo(); ?>
and then browse to that file. You'll see a big list of all your php settings and installed modules. Look for the openssl module and check that it's enabled. If it's not, you need to keep tweaking your WAMP environment until you can see that the module is appearing. Normally when changing Apache/php settings you need to restart Apache for the changes to be taken into account, so you may need restart your WAMP server.
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.
I've been working on Wamp Server 2.2 . Everything is ok but when I tried to enable a PHP Extension from the icon tray then Apache won't work anymore. Unless I re-install it then it will work. But I need to enable some PHP Extensions like curl and postgre pdo for my project.
I also tried manually editing the php.ini to enable php extensions, still wamp server apache won't work. Any ideas?
Just enabling a php extension from wamp does not work sometimes because if there is no extension for that module in the php's extension folder then wamp will either stop working or might give out some windows pop up error message when you start wamp.
So please check if those modules exists in the extension directory of your php's root folder.
I hope this helps you.
WAMPServer has more than one php.ini file and it is easy for beginners to get confused.
The safest way to edit the Correct php.ini file is to use the wampmanager.exe menu links
left click wampmanager -> PHP -> php.ini
This will edit the \wamp\bin\apache\apache{version}\bin\php.ini file, which is the correct one for effecting php changes for the PHP used on your web site.
The menu links should also work to activate/deactivate PHP extensions as follows :-
wampmanager -> PHP -> PHP Extensions -> click an extension
If the extension has a TICK then it is activated, if not then it is not activated. Each time you click on an extensions name, it will restart Apache to action the activation or deactivation of that extension, so give it a few seconds to complete this restart before checking it worked.
There is also a php.ini file in the \wamp\bin\php\php{version} folder, however this file is only used by the PHP CLI ( Command Line Interface ) so if you chnage this it will have no effect on the php used by Apache.
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.
I am using joomla and using WAMP as my server and I am trying to add a twitter feed to my website but I get this error message
*"Your PHP doesn't have cURL extension enabled. Please contact your host and ask them to enable it."
I then go to my PHP extensions and enable curl and i still get the same message. I even went into the php.ini file and edited it in there but still no change. Any advice on this issue would be really appreciated. Thank you
WAMPServer has more than one php.ini file. One for the configuration to use with Apache and one to use with the configuration of PHP CLI ( Command line Interface )
You could use the easy method :
Use the wampmanager menus ( thats the icon that sits in the system tray ).
ledt click wampmanager icon -> PHP -> PHP Extensions
This will give you a menu containing all the extensions, make sure that php_curl has a tick mark beside it. If it does not then click that line in the menu and it will activate that extension. Give it a few seconds to process as it autonatically restarts Apache because that is necessary to activate a new extension.
Really could not be simpler.
Or you could edit the php.ini manually again using the wampmanager menus;
left click wampmanager -> PHP -> php.ini
This will launch notepad on the correct php.ini which is actually C:\wamp\bin\apache\apachex.y.z\bin\php.ini.
Maually remove the ; (semi colon) beside the php_curl extension, save the file, and then restart Apache.
Warning: this can introduce security issues that SSL is designed to protect against.
But a really simple fix that worked for me was to call:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
before calling:
curl_exec():
in the php file.
I believe that this disables all verification of SSL certificates.
Answer by #Chris Dutrow