Settings of php.ini seem to be overwritten using xampp - php

I want to load some extensions, but my changes in the php.ini file do not have any effect. I have xampp installed on Windows and set extension_dir in php.ini to "C:\xampp\php\ext", which is where xampp installed my extensions. But when I call phpinfo(), extension_dir is shown as C:\php\ext which is not correct.
Already verified that it's the correct php.ini and did some stop and start of apache.
Also, I checked the loaded modules with get_loaded_extensions(), but my desired extension -mbstring etc- aren't displayed.
Any help is appreciated.

Finally, it was an unexpected sign & somewhere else in the php.ini file. Found it by typing prompt php.

Related

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.

edit on php.ini doesn't work

I have PHP in an Apache2.
When I do a modification in my php.ini, like uncomment a module to active it, it doesn't work.
In my phpinfo(), the Loaded Configuration File is on C:\php\php.ini, which is the right place.
I restart my Apache after every edition on the php.ini.
PHP run well on the Apache.
So why I can't active my module ? (Actually I'm trying to active the PDO driver for MySQL)
Uncomment this line to consider extensions :
; extension_dir = "ext"
extension_dir is the problem - make sure you have that pointing to the directory, where your DLL is.

Phpinfo() not showing curl

I have php_curl.dll in xampp/php/ext/ folder and in php.ini file I set extension=php_curl.dll (removed ';'). I also set extension_dir = "C:\xampp\php\extensions\" in php.ini file. Then I restarted the Apache, even I restarted the system 2 times. But till in Phpinfo() I cant see curl. and I am getting error like"Call to undefined function curl_init()"`
I have PHP version 5.2.4.
Check your Apache's error_log file. Even if php_curl.dll is activated in your php.ini, a startup problem might disable your php_curl.dll, so it doesn't show up in phpinfo(). Search for any line like this:
PHP Warning: PHP Startup: Unable to load dynamic library
Also check that the correct php.ini is loaded (is shown at the beginning of phpinfo()) and that your extension_dir is correctly configured.
"At http://www.anindya.com/php-5-4-3-and-php-5-3-13-x64-64-bit-for-windows/ . Download the file that you need from the fixed curl extensions list at the bottom of the page, for example Windows 7 64 bit Machines will work correctly with the non nts file."
Source: http://www.developingtheweb.co.uk/php-5-4-3-and-5-3-13-curl-extension-fix/
Add
extension=php_curl.dll
in php.ini
Not every php_curl.dll is compatible with your system configuration. Make sure you are using a compatible version of the extension.
Yet, to make sure that you are editing the correct php.ini, you can read the phpinfo's output. It will tell you which php.ini file has been loaded. Make sure that you are modifying the same file.
You may need to use the entire path instead of the relative path.
Changing that line to this fixed it for me:
extension="C:\php\ext\php_curl.dll"

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.

Unable to enable PHP LDAP even though I have edited php.ini and php_ldap.dll is in the right place?

I've been working with a WAMP install for quite a while now with LDAP enabled and everything is going smoothly. Now though I have to set up another machine and for some reason I can't enable LDAP.
I checked the output of phpinfo() and the LDAP section isn't there. I edited php.ini to uncomment the line:
extension = php_ldap.dll
I also checked the filepath being searched for extensions and the file php_ldap.dll is in the right place.
I'm positive I'm editing the right php.ini file since I checked the filepath being shown by phpinfo(), and also I am able to successfully enable/disable other extensions.
I have rebooted Apache after every change made.
While Googling this, the only solutions I found were those above, plus one or two mentions of editing the Windows PATH variable to include the path to php.ini? Tried it even though it didn't make sense to me (as I already know php.ini is being parsed). I also checked my previous install on the other machine and from what I can see I never added any PHP directories to the PATH on that machine
Edit with complete answer
Frank's answer below led me to the solution so I thought I'd consolidate everything now.
To Enable LDAP Support on a WAMP server:
Uncomment extension = php_ldap.dll in php.ini
IMPORTANT: Make sure that you're editing the right php.ini by checking the output of phpinfo()
Check the php.ini file for the location of your extensions directory
Check that php_ldap.dll is located in that directory
(THE STEP I MISSED) Find the files libeay32.dll and ssleay32.dll and add their directory to the Windows PATH
Reboot Apache. If LDAP is enabled there will be a section about it in the output of phpinfo()
There are a few hints here: http://php.net/manual/en/ldap.installation.php . Note you need to add two other DLLs libeay32.dll and ssleay32.dll. You may also need to compile with --with-ldap
I followed these instructions but still couldn't get LDAP loading in my phpinfo(). The Apache logs showed on startup the following non-fatal message: ######/php5.4.16/ext/php_ldap.dll - The specified module could not be found. in Unknown on line 0
In the end, I looked at phpinfo() again and saw that the system variable PATH was being used instead of my user variable PATH and it didn't contain the correct path to PHP's root and PHP's extension folder. Simply adding them in ####\php\php5.4.16;####\php\php5.4.16\ext; and restarting Apache, solved the problem. Hope this can help someone else out.
Check out libsasl.dll libeay32.dll, ssleay32.dll in your PHP folder
If libeay32.dll, ssleay32.dll are not there, download it from https://code.google.com/archive/p/openssl-for-windows/downloads
Copy them to System32 folder in Windows
Now you can see LDAP section on you phpinfo(). it worked for me.
My environment
Windows 10
PHP 7.4.3
Apache 2.4.41
im using phpstorm. if you cant find the comment, just paste"extension = php_ldap.dll" at the bottom of your php.ini page. you are welcome

Categories