PHP Windows extensions won´t load
Asked Answered
A

3

12

I'm working on a windows server 2008 R2 machine. I have installed apache 2.2 with php 5.4.25 While trying to enable ldap support for the apache server i found out that the server does not load the extensions.

I ran php_info() and this was the result

Configuration File (php.ini) Path

C:\Windows Loaded configuration file: "C:\php\php.ini

extension_dir C:\php\ext

I have changed the php.ini to load the extensions, but they are not loaded and they are not visible in the php_info dump. I tried to restart the server and apache about a million times while doing changes with no luck. So if anyone knows a solution to this it would be great.

Amphisbaena answered 7/3, 2014 at 13:49 Comment(0)
A
6

I had a lot of problems with this as well. Make sure you're configuring the right php.ini file. For some reason I had two of them.

This is from my phpinfo()

Configuration File (php.ini) Path   C:\Windows
Loaded Configuration File   C:\wamp\bin\apache\apache2.4.4\bin\php.ini <--- this is the one I needed to manually update

Then I dumped my php_ldap.dll file in:

C:\wamp\bin\php\php5.4.16\ext

Updated my php.ini file to load the extension

Added the PHP directory to the Windows path.

More info here:http://www.php.net/manual/en/faq.installation.php#faq.installation.addtopath

Mine looks like

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\Shoreline Communications\ShoreWare Client\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;c:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;c:\Program Files\Microsoft SQL Server\110\DTS\Binn\;c:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;c:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;c:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;c:\wamp\bin\php\php5.4.16

Image:https://i.sstatic.net/JAoTh.png

Rebooted machine and it worked.

Alfaro answered 7/3, 2014 at 13:54 Comment(2)
I´m 100% Sure i´m configuring the right php.ini file, because i´m able to change values in it. It just wont load any extensions.Amphisbaena
You shoudl never need to put ANYTHING from WAMPServer on the PATHNunnery
C
16

I had the same problem on Windows. After changing the path to the extension directory (in php.ini) to an absolute path, it worked.

As suggested in the default php.ini (not working):

extension_dir = "ext"

Turned into an absolute path (working)

extension_dir = "c:\amp\php\ext"

The strange thing is that this problem occurs on some machines / versions only. Could not nail it down. There is an official bug listed here:

https://bugs.php.net/bug.php?id=74866

Cairn answered 19/8, 2020 at 14:24 Comment(4)
FWIW I changed extension_dir from the default of "ext" to ".\ext" and it worked.Intelligibility
I just uncommented ;extension_dir = "ext" and it workedGoer
had 2 versions of php7 on same machine (one with Apache, one with IIS). This is the only solution that fixed my problem. Apache kept loading the wrong php modules...Ithunn
extension_dir = "ext" working on PHP 5 & 7, but not working on some versions of PHP 8. Changing extension_dir from the default of ext to .\ext worked on PHP 5,7,8... Also ./ext will not valid on Windows (didn't understand why). If you running PHP under Apache, then extension_dir is relative to httpd.exe (not to php.exe). It was never documented! PHP devs never testing PHP on Windows. Almost never fixing Windows bugs. Shame...Acutance
A
6

I had a lot of problems with this as well. Make sure you're configuring the right php.ini file. For some reason I had two of them.

This is from my phpinfo()

Configuration File (php.ini) Path   C:\Windows
Loaded Configuration File   C:\wamp\bin\apache\apache2.4.4\bin\php.ini <--- this is the one I needed to manually update

Then I dumped my php_ldap.dll file in:

C:\wamp\bin\php\php5.4.16\ext

Updated my php.ini file to load the extension

Added the PHP directory to the Windows path.

More info here:http://www.php.net/manual/en/faq.installation.php#faq.installation.addtopath

Mine looks like

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\Shoreline Communications\ShoreWare Client\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;c:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;c:\Program Files\Microsoft SQL Server\110\DTS\Binn\;c:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;c:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;c:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;c:\wamp\bin\php\php5.4.16

Image:https://i.sstatic.net/JAoTh.png

Rebooted machine and it worked.

Alfaro answered 7/3, 2014 at 13:54 Comment(2)
I´m 100% Sure i´m configuring the right php.ini file, because i´m able to change values in it. It just wont load any extensions.Amphisbaena
You shoudl never need to put ANYTHING from WAMPServer on the PATHNunnery
C
1

Have to add your php path to system environment variable? I encounter this problem before. After adding "C:\php" to window system environment variable. It works!

Carapace answered 21/7, 2021 at 8:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.