简体   繁体   English

如何从带有.user.ini和自定义扩展名的bat文件中运行Azure WebJob中的PHP文件?

[英]How to run a PHP file in an Azure WebJob from a bat file with your .user.ini and custom extensions?

If you try to use third party software (eg, Piwik) using the WebJobs feature provided by Azure, you might run into the issue that PHP neither loads the custom .user.ini nor the user extensions you enabled in the Azure portal. 如果尝试使用Azure提供的WebJobs功能使用第三方软件(例如Piwik),则可能会遇到PHP 无法加载自定义.user.ini或您在Azure门户中启用的用户扩展的问题。

Since you might also use third party software, you are also required to use the PHP from the CLI (.bat file) and can't upload a custom PHP file to be executed in the correct environment. 由于您可能还使用了第三方软件,因此还需要使用CLI中的PHP(.bat文件),并且不能上载自定义PHP文件以在正确的环境中执行。

I resolved this by redefining the PHP_INI_SCAN_DIR and specifying the extensions as arguments for php.exe. 我通过重新定义PHP_INI_SCAN_DIR并将扩展名指定为php.exe的参数来解决此问题。

set PHP_INI_SCAN_DIR=D:\home\site\wwwroot\
php.exe -dextension=D:\home\site\path_to_your_extension.dll -f "D:\home\site\wwwroot\your_php_file.php"

For Piwik, it might look like the following: 对于Piwik,它可能如下所示:

set PHP_INI_SCAN_DIR=D:\home\site\wwwroot\
php.exe -dextension=D:\home\site\bin\php71\php_igbinary.dll -dextension=D:\home\site\bin\php71\php_redis.dll -dextension=D:\home\site\bin\php71\php_geoip.dll -f "D:\home\site\wwwroot\console" core:archive --url=https://your.url.com/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM