我建立了一个新的开发窗口:
Windows 10 教授 - 阿帕奇 2.4.54 - PHP 8.1.7
问题是 PHP 无法加载扩展(无论我激活哪个扩展)。 php.ini 中的配置
extension_dir = "ext"
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
extension=curl
extension=mbstring
extension=openssl
在 apache 日志中抛出以下消息:
PHP Warning: PHP Startup: Unable to load dynamic library 'curl' (tried: ext\\curl (The specified module could not be found), ext\\php_curl.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'mbstring' (tried: ext\\mbstring (The specified module could not be found), ext\\php_mbstring.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'openssl' (tried: ext\\openssl (The specified module could not be found), ext\\php_openssl.dll (The specified module could not be found)) in Unknown on line 0
安装路径为:
c:\Webserver\Apache24
c:\Webserver\php
一开始我想到了权限问题,于是我把“Webserver”的洞目录以“完全访问”的方式对“所有人”开放,但这并不能解决问题。
看来我发现了问题。当我将 PHP 文件夹的路径添加到 Windows 环境变量并重新启动 Windows 后,错误消息消失了。
非常感谢所有评论。 事实上,extension_dir 必须具有完整路径,否则,有时 PHP 引擎可以识别扩展,有时则不能。