OpenSSL support disabled in Apache/PHP on Windows - php

openssl is disabled apache2.4 with php7.1
in phpinfo(); results give me this
OpenSSL support disabled (install ext/openssl)
i changed this in php.ini
extension=php_openssl.dll
i use this code using WINDOWS CMD
set OPENSSL_CONF=/path/to/openssl.cnf
its enabled when use in CMD this but its disabled in phpinfo();
php --ri openssl
OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 1.0.2j 26 Sep 2016
Openssl default config => C:/jampp/php71/extras/ssl/openssl.cnf
its now working in CMD and but phpinfo(); not and in laravel 5 show me this error
Call to undefined function openssl_encrypt()
Thanks

Thank you all its just need includes the (DLLs files of php) into httpd.conf
LoadFile "C:/jampp/php/libeay32.dll"
LoadFile "C:/jampp/php/ssleay32.dll"
LoadFile "C:/jampp/php/php7ts.dll"
LoadFile "C:/jampp/php/libpq.dll"

Another possible solution for anyone struggling to enable OpenSSL on Windows. Run php --ini to check whether your ini file is being ran. In my case the configuration file was set to none.
My php installation came with development and production ini files, but I needed to create a new ini file called php.ini and include my settings there.
If anyone else is struggling to install composer, this fix may work for you :)

Updated Answer 2021:
OpenSSL is in version 1.1 now. The LoadFiles file in another answer on this page have been replaced by 'libcrypto-1_1.dll' and 'libssl-1_1.dll'.
Honestly, though, that entire answer is probably outdated. In my case, the solution was far simpler. Everything I found on the internet says all you have to do is uncomment the line 'extension=openssl' in your php.ini file. However, there is usually a small piece of information omitted. You ALSO need to uncomment the line 'extension_dir = "ext"' on Windows or 'extension_dir = "./" on Linux. If you don't do this, then no extensions can load.

I have added new php version 8.2.1 today
uncommented extension_dir = "ext"
uncommented extension=openssl
Wamp control manager shows that openssl is enabled
4. Exit wamp and also restarted All services
Still the Problem persisted on phpinfo() and phpmyadmin
The solution worked for me after all is to Restart my laptop

Related

How to enable openSSL in PHP 7.4 with Apache Server 2.4?

I am aware very similar questions have been around but none seem to have the solution for my problem. I wonder if you could give me a hand with this one. I'll try to be as specific as possible:
I'm on a Windows x64
PHP version 7.4.6
Apache server 2.4.43
On the php.ini file I uncommented extension=openssl and extension_dir = "ext"
On the httpd.conf file I added this extra snippet
<IfModule php7_module>
AddHandler application/x-httpd-php .php
PHPIniDir "C:/php-7.4.6"
LoadFile "C:/php-7.4.6/libcrypto-1_1-x64.dll"
LoadFile "C:/php-7.4.6/libssl-1_1-x64.dll"
LoadFile "C:/php-7.4.6/libssh2.dll"
LoadFile "C:/php-7.4.6/nghttp2.dll"
LoadFile "C:/php-7.4.6/php7ts.dll"
</IfModule>
(I include the LoadFiles as I saw somewhere that that might be solution, well it's not for me at least)
Checked on the command line the modules installed (php -m) and it seems that the ssl module is enabled. However when checking with the extension_loaded ('openssl') instruction it returns a false. Also, with phpinfo() I see that OpenSSL support is disabled and I should install (ext/openssl).
I don't know why they are telling me opposite things. https wrapper is not enabled either.
I checked if both php and apache were reading from different php.ini files and they both say the same thing:
Configuration File (php.ini) Path C:\WINDOWS
Loaded Configuration File C:\php-7.4.6\php.ini
Which btw I understand little, as there is no php.ini in the Windows folder. I understand that the file is got from the path specified below.
In the ext folder there is the php_openssl.dll file.
I tried to include C:\php-7.4.6\libcrypto-1_1-x64.dll as environmental variable as I saw that in a different link.
And yes, I restarted the server several times.
I reckon I ran out of options and I don't know what else I should do. Thanks for your help!
I try to attach the links that I've been visiting, although I'm sure I'm leaving some behind as I lost track.
Unable to find the wrapper "https" with file_get_contents
OpenSSL Support disabled in Apache 2.4/PHP 7.4.4
PHP OpenSSL extension not working while install Typo3 6.2.2 on window7
How to enable HTTPS stream wrappers
Thanks a lot!
Fortunately I managed to get it to work and I want to share with you all the solution in case you are facing the same problem.
I happened to think about checking the error logs of Apache and the following error was registered for every module: Unable to load dynamic library. It was trying to take the module from the /ext folder, which it didn't know where it was, so what I did was to change in the php.ini file the extension_dir to an absolute PATH "C:\php-7.4.6\ext" and now it works like a dream!
There is a line in php.ini:
;extension_dir = "ext"
You just have to uncomment it in addition to uncomment extension=php_openssl.dll as well.

pgsql extension is not loading

I am trying to use pgsql extension on Windows 10 64-bit (WAPP).
I have:
restarted Apache
uncommented all postgresql extensions in php.ini
used LoadFile to load pgsql.dll
moved pgsql.dll to Apache bin (I tried both dll from php folder and from postgresql)
But still no result.
pgsql is visible only in php.exe -m but not in phpinfo(), extension_loaded(), get_loaded_extensions().
My php version is 7.1.8 and PostgreSQL is 9.6 and Apache is 2.4.27.
My php.exe -m output:
What can be the problem?
[SOLVED]
Okay, after a few hours of looking, I found the problem and was able to solve the problem with the pdo_pgsql and pgsql modules not showing in phpinfo().
[SOLUTION]
After uncommenting the extensions in php.ini, go into httpd.conf and add at the top of all the LoadModule lines the following:
LoadFile "C:/Program Files/PostgreSQL/9.6/bin/libpq.dll"
(assuming you are using the latest version of PostgreSQL, otherwise change the number to the version you are using).
Save and restart Apache. Go to phpinfo() and you will see it is loaded.
[REASON]
Apache is unable to see the libpg.dll even if you copy it into the Apache/bin folder.
[ENVIRONMENT]
Windows Server 2016 (works for Windows 10 as well)
Apache 2.4.26
(x64) PHP 7.1.8 (x64 ThreadSafe VC14)
PostgreSQL 9.6.4 (x64)
Usually, command line PHP does not share the configuration file with Apache or in other words, the Apache php.ini is a different one then the one you edited.
Use phpinfo() running through apache and search for php.ini to locate the configuration file that was loaded.
The accepted solution also works for the latest version of PHP 7, namely 7.3.5 on Windows 10 environment.
The inclusion of the LoadFile directive atop all the LoadModule directives simply works fine. I too was struggling for the solution. It appears that there is some issue on the said environment that the libpq.dll doesn't get loaded by default. The solution is awesome.

Composer Warning: openssl extension is missing. How to enable in Denwer

I try install Composer and it returns error: The openssl extension is missing. The recommended option is to enable the extension in your php.ini.
In php.ini string "extension=php_openssl.dll" is not commented out.
I use Denwer.
How can I solve my problem?
According with this Question: Composer Warning: openssl extension is missing. How to enable in WAMP WAMP (like Denwer) uses different php.ini for Apache and for CLI (PHP running in terminal, like composer).
As long I can see the php.ini file in Denwer is locate in "C:\WebServers\usr\local\php5\php.ini" and by default line "extension=php_openssl.dll" is commented (;), even uncommenting it PHP doesn't load OpenSSL.
In this site: http://hardmandev.com/article/nastroyka-openssl-dlya-denwer/ (In Russian) they suggest a way to make Openssl works on Denwer. According the feedback in the commentaries, this trick works.
I hope this can help you.

Call to undefined function curl_init() error in wamp 2.2

I am having below error when I try to implement google and facebook authentication in windows 7 using wamp server.
Fatal error: Call to undefined function curl_init() in
E:\wamp\www\mysite\protected\extensions\eauth\EAuthServiceBase.php
on line 273
I am using,
wampserver 2.2
php version 5.3.13
I have enabled php_curl module as well. I checked in php.ini for confirm and it is uncommented as below.
;extension=php_bz2.dll
extension=php_curl.dll
;extension=php_dba.dll
The code has worked in ubuntu with xampp, but not in wamp in windows. I have done everything I can find. I have tried replacing the php_curl.dll also according to the comment on this thread, Call to undefined function curl_init() - with WAMP
My phpinfo() looks like below.
I have installed wamp in the partition E:\, but the "Configuration File (php.ini) Path" seems different, it is C:\Windows.
Please help me to fix the issue.
Visit this and have a file under Fixed curl extensions:
http://www.anindya.com/php-5-4-3-and-php-5-3-13-x64-64-bit-for-windows/
after download and replace related file then restart server.
In browser navigate to localhost and make sure there is curl extensions showing under Loaded Extensions :
For WAMP running PHP 5.4.3 on Windows 7 64 bit, make sure you use php_curl-5.4.3-VC9-x64.zip NOT php_curl-5.4.3-nts-VC9-x64.zip.
In windows 7 with PHP 5.5.31 after check that php_curl.dll extension is enabled (and still doesnt working), work for me to copy libeay32.dll and libssh2.dll from php directory to Apache bin.
just a guess - this section in php.ini does not reference the correct location
; Directory in which the loadable extensions (modules) reside.
extension_dir = *some value*
http://www.php.net/manual/en/ini.core.php#ini.extension-dir
edit
Also, look for this block in your phpinfo, if it's not there, curl isn't loading (obviously). You're not looking for matching version numbers - just for the block's existence.
edit
look at this question also
PHP and CURL under Windows 7 64 bits and Apache
When using WAMP..
You should have one file php.ini in the main PHP directory
In the php.ini enable the extension extension=php_curl.dll, by removing the ; char
The extension_dir must look like this example: extension_dir = "D:\AMP\PHP\ext\", so not a relative path
You need to restart Apache server only once. No need to restart it many times
Just make sure, you have the php_curl.dll in the ext directory
(windows 10 user)
Since this is the first result in Google and I had exactly the same problem and none of your solutions worked for me and I finally find the correct solution in an other thread of stackoverflow, I'll post link here :
EasyPHP Devserver 16.1 Curl Win 10
The solution is to add the your current PHP directory (depend of which version you use) to your global "path" variable in windows (like explained in the link, but you don't need to add all php directorias of course)
Not sure where to put my experience, hope it will be useful for someone.
In my case (win7 x64 + apache 2.4 + php 7.2), curl extension was enabled in php.ini but did not load. Resolved by replacing libs libssl-1_1-x64.dll and libcrypto-1_1-x64.dll in Apache's bin folder with the latest builds of OpenSSL
For those running PHP 7+ on windows, there is no php.ini file in the php directory by default.
You need to:
create a php.ini file in your PHP directory (it should be under C:\php\, or wherever your php directory is located)
Copy the content of either php.ini-development or php.ini-production into the php.ini file you've created.
Finally remove the semicolon (;) before extension=curl
Change the extention in php.ini file uncomment by removing ; like below
;extension=php_bz2.dll
extension=php_curl.dll
;extension=php_dba.dll
Then restart all services and it will work.

Enabling the OpenSSL in XAMPP

I spent three hours but I did not find anything; I'm unable to connect to a SSL enabled server. I want to list what i did:
First checked my PHP extensions directory was in order; extension wasn't there, php_openssl.dll
Then I opened my php.ini file but I could not see any extension=php_openssl.dll line to uncomment.
Also, I searched on Google and saw people with the same problem.
http://www.apachefriends.org/f/viewtopic.php?p=162623
However, I also have
OPENSSL_CONF C:/xampp/apache/bin/openssl.cnf
...
openssl
OpenSSL support enabled
OpenSSL Library Version OpenSSL 0.9.8l 5 Nov 2009
OpenSSL Header Version OpenSSL 0.9.8l 5 Nov 2009
no lines . What should I do? Please share your suggestions.
Yes, you must open php.ini and remove the semicolon to:
;extension=php_openssl.dll
If you don't have that line, check that you have the file (In my PC is on D:\xampp\php\ext) and add this to php.ini in the "Dynamic Extensions" section:
extension=php_openssl.dll
[PHP_OPENSSL]
extension=php_openssl.dll
This is the answer.
Things have changed for PHP > 7. This is what i had to do for PHP 7.2.
Step: 1: Uncomment extension=openssl
Step: 2: Uncomment extension_dir = "ext"
Step: 3: Restart xampp.
Done.
Explanation: ( From php.ini )
If you wish to have an extension loaded automatically, use the following syntax:
extension=modulename
Note : The syntax used in previous PHP versions (extension=<ext>.so and extension='php_<ext>.dll) is supported for legacy reasons and may be deprecated in a future PHP major version. So, when it is possible, please move to the new (extension=<ext>) syntax.
Special Note: Be sure to appropriately set the extension_dir directive.
So, what did we do to make openssl_pkey_new() and all the other openssl_ functions in PHP work...
Enabled the extension php_openssl.dll in the (right/active) php.ini. Checked.
Checked that there exists a openssl.cnf in xampp\apache\conf\ (and also in two other directories within XAMPP). Checked.
Added the environment variable OPENSSL_CONF in the Windows system settings with the full path to the above openssl.cnf. Checked.
Restarted Apache (and after that did not work restarted the computer several times...). Checked.
Still does not work, and throwing errors such as
error:0E06D06C:configuration file routines:NCONF_get_string:no value
error:02001002:system library:fopen:No such file or directory
error:2006D080:BIO routines:BIO_new_file:no such file
Okay, here are another two more things to check.
1. Trouble with the environment
Run phpinfo() from a PHP script, and go to the "Apache Environment" section. Check the value of OPENSSL_CONF.
Surprise. This is not what we have set in the windows system settings.
The solution is simple. Set the environment variable in the PHP script.
putenv('OPENSSL_CONF=C:\xampp\apache\conf\openssl.cnf');
2. Trouble with relative filenames
Now, openssl_pkey_new() will work, but openssl_pkey_export_to_file() does still not work and returns false without any further explanation?
Check the filename that you have specified as output filename. It will not work in Windows as long as you do not specify the full path.
$folder = realpath('../keyring');
$outfile = $folder.'/private.pem';
openssl_pkey_export_to_file($key, $outfile);
I use xampp. Beforehand I tried the example file "test_smtp_gmail_basic.php" in phpMailer (you can download phpMailer here: https://github.com/Synchro/PHPMailer), but I got the following error:
Mailer Error: The following From address failed: xxx#gmail.com
After I commented out ; extension=php_openssl.dll in php.ini, it is working now.
In xampp, if "extension=php_openssl.dll" is not present in your php.ini file then add it in the "Windows Extensions" section of your php.ini file
and restart your apache.
It works for me..
You will need to edit your php.ini. It's 4 easy steps.
Find your php.ini file.
$inipath = php_ini_loaded_file();
Enable openssl in the file:
extension=php_openssl.dll
Turn allow_url_fopen on
allow_url_fopen = On
Restart apache and you are done!
STEP 1: On your php.ini comment out ;extension=php_openssl.dll
STEP 2: Copy libeay32.dll and ssleay32.dll from your PHP root folder and paste it your Apache/bin folder
STEP 3: Restart Apache
I am assuming that this question is for those using a windows based system.
After making sure that the extension extension=php_openssl.dll in your php.ini file does not have a semicolon.
Then make sure that you have added C:/xampp/apache/bin into your environment path in order to use openssl without having move the command prompt to that directory C:/xampp/apache/bin
Although not related to this question but as the WP migrate Pro docs link to this question I though I would post an answer here.
If your having problems with DB Migrate Pro activating instead of enabling SSL you can just add a line of code to your wp-config
define( 'WPMDB_LICENCE', 'XXXXXXXXXXx' );

Categories