I wanted to use some extensions of PHP 7.1 after installing it and Apache 2.4 and on my Windows 7. I wrote a small test script index.php to call some functions of the given extensions.
<?php
var_dump(mb_strlen('p'));
var_dump(mysqli_connect_error());
and uncommented the appropriate lines from the php.ini, like
...
;extension=php_ldap.dll
extension=php_mbstring.dll
;extension=php_exif.dll ; Must be after mbstring as it depends on it
extension=php_mysqli.dll
;extension=php_oci8_12c.dll ; Use with Oracle Database 12c Instant Client
...
and configured the extension_dir according to the windows-specific part of the php.ini
; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
; extension_dir = "ext"
extension_dir = "ext"
I restarted the Apache web server and fetched the http://localhost/index.php. I got the error messages:
Fatal error: Uncaught Error: Call to undefined function mb_strlen() in C:\Program Files\Apache24\htdocs...
which means the extension was not loaded.
I doublechecked that the php.ini I made the modifications in is the same as the phpinfo() displayed in the browser:
Loaded Configuration File C:\Program Files\php\php.ini
On the contrary, if I started the same index.php not via web server but from the command line then I got different output:
C:\Program Files\Apache24\htdocs>"C:\Program Files\php\php.exe" index.php
int(1)
NULL
which means the extensions were loaded properly.
The command line PHP uses the same php.ini:
c:\Program Files\Apache24\htdocs>php -i|find "Loaded Configuration File"
Loaded Configuration File => C:\Program Files\php\php.ini
How can it be that the same php.ini file loads the extensions from command line but does not load them when used via the web server?
Contrary to the description in the php.ini, the extension_dir should be specified with a full path, not just a relative one. Changing the line in php.ini from
extension_dir = "ext"
to
extension_dir = "C:/Progra~1/php/ext"
and restarting the web server solved the problem.
NB: I used the DOS-8.3 path instead of "C:/Program Files/php/ext" because according to the php-7.1.11-Win32-VC14-x64.zip\install.txt manual, it does not like paths containing spaces:
You may choose a different location but do not have spaces in the path (like C:\Program Files\PHP) as some web servers will crash if you do.
The path I referred to doesn't contain any spaces so I don't think I did anything wrong. Despite this, I am not sure how it would work if I had installed php to the default directory c:\php but it seems that defining the full path is a more secure way.
Check which modules is Apache using:
go to your apache config. IE: cd /etc/apache2/mods-enabled
list enables modulesls -lsai php* (in my case, prev version was enabled)
remove previous modules (IMC: rm php*)
enable needed module. IMC:
sudo ln -s ../mods-available/php7.4.load
sudo ln -s ../mods-available/php7.4.conf
reload apache (IMC: sudo /etc/init.d/apache2 restart)
use print/dump phpinfo(); to check which php module Apache is runnig
Command in example will work on Linux/Unix machines. Not on windows I'm afraid
I'm trying to run the Magento installer on Windows 7 with MAMP 3.3.0 . When I do that Readiness Check says to me that: xsl & intl extension is missing.
I have both dll in the /ext dir .
I have two php.ini files in conf\php7.0.13\ dir : php.ini-development & php.ini-production. I already uncomment the xsl and intl in the both php.ini files.
Copied icu***.dll from php to apache bin folder too but still gets the same
error.
Help me, please. If I have not clearly explained, what information is needed to solve the problem?
What could the issue be?
I suppose you're trying to make it run on Windows otherwise there is no meaning in using .dll files.
Before starting the configuration of the Magento drop a file in that configuration with
phpinfo();
and get the exact location of the used php.ini file so you'll be sure there's not a 3rd one.
Uncomment and check the location of the extensions.
Please edit php.ini in the php installed folder usually present in /etc/php
old code
...
;extension=php_intl.dll
...
...
;extension=php_xsl.dll
new code
...
extension=php_intl.dll
...
...
extension=php_xsl.dll
save and restart your apache.
IN xamp/php/php.ini search and modify php.ini file and search (;extension=php_xsl.dll) line and remove ; before line start same as remove ; before (;extension=php_intl.dll) in php.ini and save php.ini file.and open xamp manager and stop apache servises and restart again.
So, I'm trying to use a table in a php program and I got a fatal error (class mysqli not found) which after researching on stackoverflow means I don't have extension=php_mysqli.dll enabled (here's the php-website which talks about enabling it: http://php.net/manual/en/install.windows.extensions.php.)
But I looked in my php.ini file and the sort of ";extension=..." lines that it talks about commenting aren't there (I did ctrl + f to search through as well as manually searching through). I tried just adding the "extension=php_mysqli.dll" line but it still didn't work.
Someone else also said you need to uncomment the extension_dir line in php.ini and specify my location but that line only appears in an if loop in php.ini and it's not commented out. (from this stackoverflow question: Fatal error: Class 'MySQLi' not found).
How do I add "extension=php_mysqli.dll" to my php.ini file so my php program can create a mysqli table?
If you don't have mysqli extension in you php version you should download another version of PHP.
http://windows.php.net/download/
Get PHP 7 OR PHP 5.6 last version (thread safe recommended).
After, following the instructions on this page http://php.net/manual/en/install.windows.extensions.php to activate mysqli extension.
;extension=php_exif.dll
extension=php_mysqli.dll // Uncomment this line
;extension=php_oci8_12c.dll
You can define the path of your php extensions folder if you have problems.
To do this, uncomment line extension_dir.
extension_dir = "C:\php\ext" // Your ext folder path
Restart your apache / nginx and try to use mysqli functions.
Hope this will can help you.
In my case, I had the extension=mysqli set in my php.ini and the php_mysqli.dll file in the php/ext folder, I just had to uncomment (remove the ;) the extension_dir line in php.ini:
; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
;extension_dir = "./"
; On windows:
extension_dir = "ext"
Save php.ini and restart php and the webserver.
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.
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.