I'm using WAMP on Windows with several version of PHP. The one I currently use is PHP 7.3.12. After following carefully every step of installing the cacert.pem file into my WAMP folder, my PHP does not seems to see it. Here's the step I've taken to install it:
I downloaded the cacert.pem file from https://curl.haxx.se/docs/caextract.html
I moved this file into my extras\ssl folder of my PHP folder (C:\dev\wssp\wamp\bin\php\php7.3.12\extras\ssl\cacert.pem)
I wrote this absolute path into the php.ini file from WAMP, after curl.cainfo (and I removed the ; caracter), by left-clicking the WAMP icon>PHP>php.ini. This file is located here: C:\dev\wssp\wamp\bin\apache\apache2.4.41\bin\php.ini.
Then I restart my WAMP services and it literally copy this file on the php.ini file of the PHP version I'm currently using here: C:\dev\wssp\wamp\bin\php\php7.3.12\phpForApache.ini.
Even after theses steps, PHP do not seems to see my cacert file because when I try to dd(ini_get('curl.cainfo')) if give me this:
Just to be sure, I looked into my phpinfo() in the curl section:
But when I dumped my php.ini file with this command dd(file_get_contents(php_ini_loaded_file()));, I can clearly see my curl.cainfo path:
I'm not sure what I did wrong, but when using GuzzleHTTP from my Laravel projet, I tried giving the library an absolute path $client = new \GuzzleHttp\Client(['verify' => 'C:\dev\wssp\wamp\bin\php\php7.3.12\extras\ssl\cacert.pem']); and it worked. I still want to be able to use it with the php.ini file for environnement purpose.
Related
I have wamp install on my computer and IIS. All the websites are running well but then any command I type using php is not working :
php -v
php composer install
I would say it is the path variable (I am on windows) but the path is set correctly and it would generate an error of not finding php command. When I run those command I simply don't get any result.
What might be the problem, I am still searching but have not found any clue.
php -h
: return result with all the help information but php -a does nothing too.
After doing some research I found that this problem happens when I activate an extension by remove ; in php.ini whenever I leave php.ini without activating any extension everything works.
Check if the path contains php, also using the cd command, move to the location of the file and run the command you want to execute. If it works, you're sure the problem is the windows path.
I have fixed the issue. To see if the problem was with php.ini, I replaced the content of my php.ini with the php.ini-production file which made the php function well but almost all the extensions were desactivated.
As I was analysing I noticed wamp had many php extensions activated but in my php.ini residing under C:\wamp64\bin\php\php7.3.5 none of these extensions were activated following the path the file used by wamp I found it was using the phpForApache.ini via a link php.ini file inside C:\wamp64\bin\apache\apache2.4.39\bin
Since the wamp php configuration was working well, I just copied the content of that phpFOrApache.ini content in my php.ini after saving ... everything started working.
I just downloaded and installed the wamp server but the file php.ini file can not be found anywhere although the configuration page shows
C:\wamp64\bin\apache\apache2.4.17\bin\php.ini
I was wondering if somebody knows the root cause.
Is it possible to get the file from somewhere for that version?
Yes, you can get that file really easy. It's a php configuration file. If you know your installed php version go to PHP net
and download it for your version.
In there you will find php.ini-production(production settings) and php.ini-development (development setting better suited for debugging). Pick one and rename it to php.ini (php as name for file and ini being extension). Now you are ready to go after you copy it to your installation folder.
Make sure to resart your server after applying the changes.
I am using PHP 5.5.25 with Apache 2.4 on Windows 7 x64 and I am unable to activate the cURL module. I have looked around and tried all I could think of. Please assist:
In php.ini, the line extension=php_curl.dll is active and the file php_curl.dll is present in the extensions directory C:\php\ext
In php.ini when I set extension_dir = ext, none of the extensions load. I get several messages when Apache starts, similar to Unable to load dynamic libraryext\php_openssl.dll- The specified module could not be found.
When I use the full path and set extension_dir = C:\php\ext, all the extensions load fine, except for cURL. I get the error: Unable to load dynamic libraryC:\php\ext\php_curl.dll- The specified module could not be found.
I have tried renaming the extension to php_curl.new.dll and adjusting php.ini but I get an error message about the new filename. I have also downloaded a fresh new copy of the DLL from windows.php.net, but that made no difference.
I have checked the file permissions for php_curl.dll (Right-click on the file >> Properties >> Security tab) and they are the same as the permissions for extensions that load successfully
I have copied and pasted libeay32.dll and ssleay32.dll from the PHP bin directory to the System32 and SysWOW64 directories as instructed by a response to this question
I am certain that I am editing the right php.ini since the PHP startup error messages changed when I changed the extension_dir value from ext to C:\php\ext as I explained above.
I have made sure to restart the Apache server between php.ini configuration changes.
If in a PHP script I execute var_dump(file_exists('C:\php\ext\php_curl.dll'));, I get boolean True so PHP can see the file!
What else could explain why the cURL module is not enabled?
I think you'll need libssh2.dll in your PATH too.
Credit goes to #Steven Hilder for pointing me in the right direction.
The problem was that Windows could not see libssh2.dll, another DLL that was in PHP's directory. Copying this file to C:\Windows\SysWOW64 and C:\Windows\System32, along with the other two DLL files from my OP (libeay32.dll and ssleay32.dll) worked.
I am uncomfortable with this solution though because when the time comes to update to a new PHP version I will have a harder time remembering to overwrite these DLLs with the new version.
Therefore, I decided to remove all 3 DLLs from the System32 and SysWOW64 directories. Instead, I just added the PHP bin directory to the Windows' PATH variable, so that the next time the OS is looking for a missing file, it will also look in that directory. This has the added bonus that if a similar problem with another DLL occurs, it will be resolved automatically.
To add the PHP bin to Windows' PATH:
From the Start Menu search bar, search for and select Advanced system settings
Click Environment Variables. Scroll down the list of System variables to select Path and click Edit... to open the current PATH setting
Append ;C:\php or whatever directory has php.exe to the current setting (semi-colon is used to separate paths).
on windows the cURL execution wants SSL certificate. may be because of that others error is showing.
Put the below code before curl_exec(curlHandle) to ignore checking for SSL certificate
//to ignore the SSL certificate in windows
curl_setopt($curlHandle, CURLOPT_SSL_VERIFYPEER,false);
I have set up a MAMP server on my local computer.
The server runs fine, no problems, but I need to install the mcrypt extension on PHP as I need to install Laravel.
I've been following this tutorial:
http://coolestguidesontheplanet.com/install-mcrypt-php-mac-osx-10-9-mavericks-development-server/
I have an issue with the last step. When I create a new php.ini file using the following Terminal command, PHP refuses to run at all.
sudo cp /etc/php.ini.default /etc/php.ini
Basically with no php.ini file in the etc/ folder, the PHP works fine (PHP info pages load, sites using PHP run fine), but when it's in place, no PHP works and loading a PHP info page returns a blank white browser window.
Am I missing something?
OK I managed to figure out the issue, here's the solution for anyone stumbling on this in the future.
short_open_tags was disabled in the php.ini file. I simply enabled this, saved the file to the /etc folder and rebooted the Apache server and it works great now. I needed to modify the php.ini file again to add the mycrypt extension but now works great.
As you know Apache couldn't load curl modules, when its dll's are not in windows system dir even when your php path exists in system variable PATH. I want to ask,
why it could happen?
do you know other examples of same behavior, when you need to copy anything in win dir?
ps,
PHPIniDir "F:/php" <- is set
PATH=F:/php
php.ini is in F:/php and it successfully loaded
never copy php files to widows folder:
1.- Add php to windows PATH
2.- change extension_dir to FULL PATH
3.- see phpinfo for more information, paths etc...
4.- to add module:
extension = module_name.dll in php.ini
good luck