PHP Windows extensions won´t load

蹲街弑〆低调 提交于 2021-02-11 16:45:14

问题


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.


回答1:


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:http://i.imgur.com/hQUwtYA.png

Rebooted machine and it worked.




回答2:


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



来源:https://stackoverflow.com/questions/60815157/pdo-extensions-are-not-loaded-when-using-httpd-but-are-shown-when-using-built-i

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!