我開發了一個PHP腳本,它生成一個簡單的財務報告並通過SMTP(使用PHPMailer庫)發送它。PHP Azure WebJob - 失敗,退出代碼255(但在Kudu工作很好)
我嘗試使用Azure Web Jobs託管和執行腳本,但不幸的是每次運行它時都會失敗。
WebJob位於Azure上的wwwroot\App_Data\jobs\triggered\send-sales-report\send_sales_report.php
。
腳本內容如下;
wwwroot
|___App_Data
|___jobs
|___triggered
|___send-sales-report
|___send_sales_report.php
|___inc
|___class.EmailMessage.inc
|___emails
|___sales_report.php
|___E-Mail.php
當我運行PHP WebJob使用:可以看出,該腳本導入了一些其他的腳本:
<?php
try
{
include "./../../../../inc/class.EmailMessage.inc";
include "./../../../../E-Mail.php";
$message = new EmailMessage('sales_report', array());
SendOrderEmail('Sales Report', $message->render(), '[email protected]', 'Recipient Name');
}
catch (Exception $e)
{
echo 'Caught exception: ', $e->getMessage(), "\n";
}
?>
此外,上述文件的目錄結構如下Azure Portal(無論是手動還是按計劃),它都會失敗,退出代碼爲255;但是,當我在Azure上使用Kudu控制檯執行腳本時,它工作得很好。另外,我也在本地複製了運行環境並且工作正常。
任何幫助,非常感謝。