我在Windows 2008服务器上使用Apache2.4和php7。
如果运行php -m,则可以看到它们已安装
但是当我将此代码放入apache / htdocs下的.php文件并通过localhost / aaa.php访问它时
<?php
print_r(get_loaded_extensions());
?>
未显示启用的扩展名,输出为
Array ( [0] => Core
[1] => bcmath
[2] => calendar
[3] => ctype
[4] => date
[5] => filter
[6] => hash
[7] => iconv
[8] => json
[9] => SPL
[10] => pcre
[11] => readline
[12] => Reflection
[13] => session
[14] => standard
[15] => mysqlnd
[16] => tokenizer
[17] => zip
[18] => zlib
[19] => libxml
[20] => dom
[21] => PDO
[22] => Phar
[23] => SimpleXML
[24] => xml
[25] => wddx
[26] => xmlreader
[27] => xmlwriter
[28] => apache2handler
)
如果我将其放入a.php并通过localhost访问它,我还可以看到未安装GD。
<?php if ( extension_loaded( 'gd' ) ): ?>
<li class="success">GD extension loaded.</li>
<?php else: $success = FALSE; ?>
<li class="fail">You do not have the GD PHP extension loaded.</li>
<?php endif; ?>
但是,如果我运行php.exe a.php,结果显示GD已加载。
因此,似乎通过apache服务器和本地php可执行文件运行会返回不同的结果。有人可以帮忙吗?