简体   繁体   English

Azure网站上Azure WebJobs中的PHP

[英]PHP in Azure WebJobs on Azure Website

I've written a powershell script that basically calls php %WEBROOT%\\dir\\ and set it to run as as WebJob in Azure - this is on an Azure Website. 我编写了一个powershell脚本,该脚本基本上调用php%WEBROOT%\\ dir \\,并将其设置为在Azure中以WebJob的身份运行-这是在Azure网站上。

The problem I am having is it does not pickup the .user.ini file that is configured (and working) on the Website. 我遇到的问题是它没有拾取在网站上配置(和工作)的.user.ini文件。 I've been playing around with powershell in kudu and am at wits end on how to get this to work. 我一直在Kudu中使用powershell玩耍,并且对如何使它起作用感到不知所措。

Is there anyway to launch php in a away that is can append a user.ini file to the standard php.ini file? 无论如何,有没有可以将user.ini文件附加到标准php.ini文件中启动php的方法? Otherwise my only solution I can think of so far is to read the entire php.ini in D:\\Program Files\\xxx, copy it, append to it and execute php with my modified version. 否则,到目前为止,我唯一能想到的解决方案是读取D:\\ Program Files \\ xxx中的整个php.ini,将其复制,追加并使用修改后的版本执行php。 This isn't an ideal solution and I'm trying to get around it if possible. 这不是理想的解决方案,如果可能,我会尽力解决。

Alternatively, the other way around it is to declare using ini_set() the variables I want to change at run time but the problem with this not all my vars are set - in particularly error_reporting. 或者,解决该问题的另一种方法是使用ini_set()声明要在运行时更改的变量,但并非所有var都设置了这个问题-特别是error_reporting。 If someone can help me work out a way to turn off E_STRICT & E_NOTICE it would also solve my problem. 如果有人可以帮助我找到关闭E_STRICT和E_NOTICE的方法,那也可以解决我的问题。 I've tried error_reporting(0) and all the different way but it completely ignores them - it works fine with date.timezone, include_path, etc. 我已经尝试过error_reporting(0)和所有不同的方式,但是它完全忽略了它们-它可以很好地与date.timezone,include_path等一起使用。

Config options can be set with the -d parameter upon calling the PHP executable. 可以在调用PHP可执行文件时使用-d参数设置配置选项。 I used it to include the mongo extension, which is not included by default. 我用它来包含mongo扩展,默认情况下不包含。 My job is a .bat file with the line below. 我的工作是一个.bat文件,下面一行。

"%ProgramFiles%\PHP\v5.6\php.exe" -dextension=D:\home\site\wwwroot\bin\php_mongo.dll D:\home\site\cli\ascript.php

See the docs here 在这里查看文档

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

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