如何使用 .user.ini 和自定义扩展名从蝙蝠文件在 Azure Web 作业中运行 PHP 文件



如果尝试使用 Azure 提供的 Web 作业功能使用第三方软件(例如 Piwik),则可能会遇到 PHP 既不加载自定义 .user .ini也不加载在 Azure 门户中启用的用户扩展的问题。

由于您可能还使用第三方软件,因此您还需要使用 CLI 中的 PHP(.bat 文件),并且无法上传要在正确环境中执行的自定义 PHP 文件。

我通过重新定义PHP_INI_SCAN_DIR并将扩展指定为 php.exe 的参数来解决此问题。

set PHP_INI_SCAN_DIR=D:homesitewwwroot
php.exe -dextension=D:homesitepath_to_your_extension.dll -f "D:homesitewwwrootyour_php_file.php"

对于 Piwik,它可能如下所示:

set PHP_INI_SCAN_DIR=D:homesitewwwroot
php.exe -dextension=D:homesitebinphp71php_igbinary.dll -dextension=D:homesitebinphp71php_redis.dll -dextension=D:homesitebinphp71php_geoip.dll -f "D:homesitewwwrootconsole" core:archive --url=https://your.url.com/

最新更新