Laravel undefined function openssl_encrypt() - php

I use laravel5.1 and it works fine on php cli.
But i publish my porject to apache(version == 2.4), the problem happened.
FatalErrorException in Encrypter.php line 67:
Call to undefined function openssl_encrypt()

First make sure you installed the openssl extension (spotted by deceze), then:
Go to your php.ini file
Remove the semicolon before extension=php_openssl.dll
Restart your Apache
I'm expecting this to be the problem.

I solved same issue by copying libeay32.dll and ssleay32.dll from PHP root folder to Apache/bin folder and then restarted Apache.

If you using the Wamp server then it's happens. In Xampp server there is no need to uncomment php_openssl.dll.
To solve this Remove the semicolon before
extension = php_openssl.dll
in php.ini

as most point out, you need to uncomment openssl extension in php.ini.
I was struggling with the same too and i realized php is looking for extensions in "c:\php", but mine was a xampp installation.
Pointing extension_dir in php.ini to correct php extension path; in my case "c:\xampp\php.7\ext" solved the issue.
Hope that helps somebody.

Follow the below steps:
In PHP 7.4.3 duplicate "php.ini-development" file and rename it
to "php.ini"
Then, remove the semi-colons in front of "extension=openssl",
"extension=mbstring", and "extension_dir = ext" inside the "php.ini" file.
This worked for me and I hope it helps someone else.

I am using wampserver and i had the same problem. Openssl was enabled in php.ini but there is another ini called phpForApache which has a line to enable openssl too. It worked for me.

I'm using nginx, and my nginx installation contained a PHP folder, something like below:
C:\Users\myusername\Downloads\nginx\php\php.ini
I moved the nginx above to the root directory of C:\ and it solved the problem.

Just run the composer update command from Laravel installation directory And 02. make sure extension=php_openssl.dll is enabled in php.ini
Restart Apache Server

On Windows
Open php.ini and change path where are locate php ext
extension_dir = "C:\php\ext"

Related

The mbstring extension is missing?

I know there's tons of topics about my problem, but I can't find a solution.
I'm using wamp and I've changed my version of PHP from 5.5.12 to 5.6.16, then when I go to localhost/phpmyadmin i have this error displayed :
Fatal error: Call to undefined function mb_detect_encoding() in
C:\wamp\apps\phpmyadmin4.1.14\libraries\php-gettext\gettext.inc on
line 177
So I update phpMyAdmin from 4.1.14 to 4.5.2.
And I have this **** error:
phpMyAdmin - Error The mbstring extension is missing. Please check
your PHP configuration.
My php.ini, phpForApache.ini is configured, I have un-commented the extension, set extension_dir to C:\wamp\bin\php\php5.6.16\ext, I stumbled on many topics/forum but none of the solution works.
Do you have any idea?
Please check #36254548
Copying the php.ini file to "wamp64\bin\apache\apache2.4.17\bin" has solved my problem.
Sometimes the extensions directory is well pointed to, the dll files have been uncommented but it still doesn't work.
The next solution to use, that is if your extensions directory is correct and dll files for the mbstring has been uncommented, then copy the php.ini file and paste it into the windows directory (i.e. C:\Windows).
You then restart your wamp/xampp and it will work.
check your php.ini file. In the extensions part of the configuration you should find:
;extension=php_mbstring.dll
remove the leading ';' to uncomment and enable the extension so it looks like this:
extension=php_mbstring.dll
restart your apache and it should work.
I faced the same issue when I start wamp, suddenly my project was not working and when I check the phpmyadmin, it gives the same above error.
My debugging process found php.ini file is missing. However I already installed two PHP versions, 5.6.19 and 7.0.4. I changed the version to 7.0.4 and then re-changed to 5.6.19. It started work.
What I guess, while changing the version, all the configuration files getting re-installed in wamp folder.

php does not load ini file

I think this has been solved many times here but i have not found proper answer.
I installed apache 2.4.9 x64 VC11, PHP5.5 x64 thread-safe VC11. Then I tried to install phpmyadmin but I got error.
mbstring library is not enabled
So i uncommented it in php.ini file. My php.ini file is located in c:/php/. I added this line to my
httpd.conf file:
#configure the path to php.ini
PHPIniDir "c:/php/"
to set php.ini file path.
phpinfo()
says it loaded the file from c:/php. But the library mbstring is still not loaded so I can't use phpmyadmin it's not just about phpmyadmin its about I can't use any libraries that are not default installed.
And yes I tried to restart apache...and not just once :p. it still doesn't work I'm hopeless. Please help me solve this.
Ok, so after another while of hard brainstorming i figured it out. I have never had to set this but now.
Everything you have to do(check) is set the path to extension dir in your php.ini
look for line:
; On windows:
extension_dir = "c:\php\ext"
just change the path where are your extension located. If is this line commented with ; just uncomment it restart apache and you are good to go. Hope this help someone else too.

How to enable PHP's openssl extension to install Composer?

I am trying to install Laravel in WAMP setup. I am getting a warning message for not enabling openssl which I had already done in WAMP.
Here is a screenshot of the message.
It is possible that WAMP and Composer are using different PHP installations. Composer will use the PHP set in the PATH environment variable.
If you want to enable the openssl extension to install Composer, first you need to check the location of the PHP installation.
Open a Command Prompt, type: echo %PATH% then check for the location of your PHP installation.
Go to that location and edit the file named: php.ini.
Uncomment the line extension=php_openssl.dll by removing the semicolon at the beginning.
Now you are good to install Composer.
I solved my problem a different way. The problem is that wamp's GUI was misleading: it claimed that I had php_openssl enabled.. and if I clicked on php.ini on the same GUI.. it actually showed that extension=php_openssl.dll was uncommented..
I'm not sure if i'm using the same installer version of composer of the OP, but it actually asks you at the beginning to specify the php.exe that you like to apply composer on (which basically ensures that no one tries to apply composer to the wrong php executable as what happened with the OP)..
The way I solved this was by going myself into the installation of php within the wamp package: C:\wamp\bin\php\php5.4.12 and looking php.in there.. when I opened it I was shocked that the line extension=php_openssl.dll was actually commented! I uncommented it and it worked just fine.
I had the same problem and here the solution I found, on your php.ini you need to do some changes:
extension_dir = "ext"
extension = php_openssl.dll
Every one here talks active the openssl extension, but in windows you need to active the extension dir too.
For WAMP server, comment given by "Enrique" solved my problem.
wamp is using this php.ini:
c:\wamp\bin\apache\Apache2.4.4\bin\php.ini
But composer is using PHP from CLI, and hence it's reading this file:
c:\wamp\bin\php\php5.4.12\php.ini (so you need to enable openssl there)
For composer you will have to enable extension in
c:\wamp\bin\php\php5.4.12\php.ini
Change:
;extension=php_openssl.dll
to
extension=php_openssl.dll
If you're doing this on Windows without one of the WAMP stacks, here's how to get this going
Download an installation of PHP for Windows. Generally you'll want a non-thread safe install. You can use 32-bit or 64-bit builds
Extract the zip file somewhere. I would suggest C:\php. Composer's installer found it there without any additional prompting
The latest versions of PHP for Windows do not come with a php.ini by default. Instead, you'll see two files, as noted below. Rename one to php.ini or copy it into php.ini.
php.ini-development
php.ini-production
Open your php.ini file and remove the semicolon from this line (you might want to uncomment other things as well but this line is the only one necessary for Composer)
;extension=php_openssl.dll
That should be all you need to do. The Composer installer should do everything else you need from here.
You need to enable "extension=php_openssl.dll" in both files (php and apache). my pc files path are these :
C:\wamp\bin\php\php5.3.13\php.ini
C:\wamp\bin\apache\apache2.2.22\bin\php.ini
This is an old question but I just had the same issue (with PHP7) and the solution was, in the end, pretty simple. Uncommenting the line in php.ini as per the other answers wasn't quite enough though. I needed to change it from:
;extension=php_openssl.dll
to:
extension=ext/php_openssl.dll
Note the ext prefix. The dll already existed but was in a subfolder. After changing the config the composer installer was happy.
you need to enable the openssl extension in
C:\wamp\bin\php\php5.4.12\php.ini
that is the php configuration file that has it type has "configuration settings" with a driver-notepad like icon.
open it either with notepad or any editor,
search for openssl "your ctrl + F " would do.
there is a semi-colon before the openssl extension
;extension=php_openssl.dll
remove the semi-colon and you'll have
extension=php_openssl.dll
save the file and restart your WAMP server after that you're good to go.
re-install the application again that should work.
There are two php.ini files, one for development and one for production. Leave those, there is another php.ini file for configuration settings just above them with a gear like icon edit that.
After editting the "right" files (all php.ini's). i had still the issue.
My solution was:
Adding a System variable: OPENSSL_CONF
the value of OPENSSL_CONF should be the openssl.cnf file of your current php version.
for me it was:
C:\wamp\bin\php\php5.6.12\extras\ssl\openssl.cnf
-> Restart WAMP
-> should work now
Source: http://php.net/manual/en/openssl.installation.php
I faced the same problem, but when i was lokking for php.ini and php.exe i found php.exe at C:\UwAmp\bin\php\php-5.4.15 when php.ini at C:\UwAmp\bin\apache.
I just copy php.ini at C:\UwAmp\bin\php\php-5.4.15 and Uncomment the line extension=php_openssl.dll and it fixed.
I am using WAMP server.
Actually its files showed that openssl is opened.
But manually I went to the folder and edited php.ini.
Then I found it has not opened openssl.I uncommented it and it worked after after WAMP restart.
C:\wamp\bin\php\php5.3.13
Browse to the line that reads:
;extension=php_openssl.dll
and remove the semicolon preceding the line. Restart your WAMP server services (click in your icon tray > 'Restart All Services'
If you still cannot solve your problem have a look at this. This might be the solution you are looking for
There are several php.ini files in C:\wamp\bin\php\php x-y-z folder. You may find production, development and some other php.ini files. No point of editing production and development files. Find the file which is exactly as same as the below image. (You can find it. Just type php.ini in your search bar and do a search). Open the file and remove ; from extension=php_openssl.dll. Save the file and close it. Restart all services in Wampp server. Re-install your composer.
That is it.
Wamp works with another php.ini that is in C:\wamp\bin\apache\Apache2.4.4\bin\php.ini. So you need to manualy find the correct file, that is in C:\wamp\bin\php\php5.4.12\php.ini. Uncomment the extension=php_openssl.dll line and just try to install Composer again.
For those who're having the same problem as I was. After doing all the solutions above, still didn't work for me. I found out that, uWamp was creating the PHP.INI file in bin/apache directory. So I had to copy the PHP.INI file into php installation directory, that is, bin/php/phpXXXX directory. This should also be where the php.exe is that you selected from the composer setup.
Hope this helps.
If you compiled from source, then adding extension=php_openssl.dll to the php.ini file may not work.
To troubleshoot this, open a command prompt and type php -i. Scroll up to the first line, it will tell you the most recent error regarding your php.ini file.
To solve the issue, find the php_openssl.dll file, for me it was in the very same directory of the compilation output:
C:\php-sdk\bin\phpdev\vc14\x64\php-7.0.13-src\x64\Release_TS
So just add the directory where the extension is, to the php.ini:
extension_dir = "C:\php-sdk\bin\phpdev\vc14\x64\php-7.0.13-src\x64\Release_TS"
Hopefully the error will be gone
If you are using xampp .Go back to where you choose which command-line php you want to use at the beginning of your installation and select the path where your xampp folder is included.After that if your installer says youve got duplicate 'extension=php_openssl.dll' comment one ssl file in your php ini with a ';'and your installation should run smoothly.

You must enable the openssl extension to download files via https

I wanted to install Zend Framework 2. So I downloaded the skeleton application. As mentioned in the ZF2 manual, we have to issue the command
php composer.phar install
Inside the skeleton.
But I'm getting an error
You must enable the openssl extension to download files via https
Then I enabled the ssl_module in my wamp, I checked the php_ini file and I can see the following line
extension=php_openssl.dll
Still I'm getting the same error. Anybody having any clue what I missed out?
PHP CLI SAPI is using different php.ini than CGI or Apache module.
Find line ;extension=php_openssl.dll in wamp/bin/php/php#.#.##/php.ini
and uncomment it by removing the semicolon (;) from the beginning of the line.
Verify you are editing the correct php.ini file.
Reference:
https://github.com/composer/composer/issues/1440
"WAMP uses different php.ini files in the CLI and for Apache. when you enable php_openssl through the WAMP UI, you enable it for Apache, not for the CLI.
You need to modify C:\wamp\bin\php\php-X.Y.Z\php.ini to enable it for the CLI."
make sure you have correct path to extension folder
extension_dir = "ext"
by default it is commented with ; character
I also had the same issue while playing around Zend Framework 2 and composer. I'm using PHP 5.4 (installed via macports) and my solution was to install openssl for PHP 5.4 via macports as well.
sudo port install php54-openssl
I have faced this problem, but configuging openssl (also for cli) did not help.
I have updated composer and this sloved my problem.
Just type:
$ php composer.phar self-update
or
$ composer selfupdate
Good luck!
I use XAMPP. In C:\xampp\php\php.ini, the entry for openssl did not exist, so I added "extension=php_openssl.dll" on line 989, and composer worked.
You need to enable "extension=php_openssl.dll" in both files (php and apache). my pc files path are these :
C:\wamp\bin\php\php5.3.13\php.ini
C:\wamp\bin\apache\apache2.2.22\bin\php.ini
Uttam, if your issue is not solved then try the follwoing 3 step approach. It worked for me as I had exactly same issue.
step1: click on wamp tray icon.
step2: goto menu apache->apache modules
step3: click on menu item "ssl_module"
it will automatically restart wamp. if wamp not restarted automatically then restart it through wamp tray menu-> Restart All services. After restart confirm that "ssl_module" coming as ticked under menu apache->apache modules
after that just attempt the php composer.phar install
from going through the response shared by you, php.ini file contains extension=php_openssl.dll and the php/ext directory also have file "php_openssl.dll"
good luck
The Valery's answer helped me:
https://stackoverflow.com/a/14265815/492457
WAMP uses different php.ini files in the CLI and for Apache. when you
enable php_openssl through the WAMP UI, you enable it for Apache, not
for the CLI. You need to modify C:\wamp\bin\php\php-5.4.3\php.ini to
enable it for the CLI.
Make sure that you update your php.ini for CLI. For my case this was C:\wamp\bin\php\php5.4.3\php.ini and uncomment extension=php_openssl.dll line.
Late answer but adding so other can learn the reason.
You also need to edit the php.ini file in the "wamp\bin\php\php-X.Y.Z" location.
I had to uncomment extension=openssl in php.ini file for everything to work!
Becareful if you are using wamp don't use the wamp ui to enable the extension=php_openssl.dll
just go to your php directory , for example : C:\wamp\bin\php\php5.4.12 and edit the php.ini and uncomment the extension=php_openssl.dll.
it should work.
Was facing this error
"You must enable the openssl extension in your php.ini to load
information from.."
I solved by finding and uncommenting the following lines on php.ini file
;extension=php_openssl
;extension_dir = "/c:\wamp64\bin\php\php 8.0.25\ext\/"
;extension=bz2
;extension=curl
;extension=fileinfo
;extension=gd
;extension=gettext
;extension=gmp
;extension=intl
;extension=imap
;extension=ldap
;extension=mbstring
;extension=exif
;extension=pdo_sqlite
;extension=shmop
in
Wamp/bin/php/php 8.0.25/php.ini
Uncomment both by removing the semicolon (;) from the beginning of each line.
If you have the latest PHP v^8 or above, likely you won't see php.ini file. So what you do is to make a copy of php.ini-development which you will see there and then rename the copy you just made to php.ini and then do the same uncommenting of the two lines then save.

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.

Categories