I have developed a PHP Script which generates a simple financial report and sends it via SMTP (using the PHPMailer library).
I am attempting to host and execute the script using Azure Web Jobs, but unfortunately the job is failing each time I run it.
The WebJob is located at wwwroot\App_Data\jobs\triggered\send-sales-report\send_sales_report.php
on Azure.
The contents of the script are as follows; as can be seen, the script imports a number of other scripts:
<?php
try
{
include "./../../../../inc/class.EmailMessage.inc";
include "./../../../../E-Mail.php";
$message = new EmailMessage('sales_report', array());
SendOrderEmail('Sales Report', $message->render(), 'name@emailprovider.com', 'Recipient Name');
}
catch (Exception $e)
{
echo 'Caught exception: ', $e->getMessage(), "\n";
}
?>
In addition, the directory structure of the files mentioned above is as follows:
wwwroot
|___App_Data
|___jobs
|___triggered
|___send-sales-report
|___send_sales_report.php
|___inc
|___class.EmailMessage.inc
|___emails
|___sales_report.php
|___E-Mail.php
When I run the PHP WebJob using the Azure Portal (both manually and on a schedule), it fails with exit code 255; however, when I execute the script using the Kudu Console on Azure it works just fine. In addition, I have also replicated the running environment locally and it is working fine.
Any help is much appreciated.