php процесс застревает в диспетчере задач, когда скрипт выполняется как задача планировщика задач - PullRequest
0 голосов
/ 26 февраля 2020

У меня есть сценарий php, который работает под планировщиком задач. Этот php скрипт запускается каждые 5 минут каждый день x 365. Я заметил, что иногда скрипты перестают работать, потому что процесс php не вышел из диспетчера задач. У кого-нибудь есть идеи относительно того, почему это должно произойти. Или я могу предпринять какие-либо превентивные меры. Я предоставил содержимое пакетного файла, из которого вызывается мой сценарий.

Любая помощь очень ценится.

@echo off
cd\
cd c:\xampp\htdocs\asset
c:\xampp\php\php.exe -f c:\xampp\htdocs\asset\assetemailqueue.php > c:\asset\assetemailqueue.log
echo %date% %time% >> C:\asset\assetemailqueue.log
cd\
exit

Сборка почты. php script

<?php

    //Make sure our assetsupportlibrary is accessible.
    include "lib/assetsupportlibrary.php";

    //Set the default time zone
    date_default_timezone_set('Europe/Dublin');

    //Connect to our database and submit password
    $conn=odbc_connect("assetemailqueue", "" ,"Password");

    //Create our SQL statement, processing all records in the email table
    $sql = "SELECT * FROM email";

    //Execute the sql statement
    $row=odbc_exec($conn, $sql);

                            if (odbc_fetch_row($row)) { //If there are records returned, process all records in the email table.

                                do { //Iterate through all our records.

                                    //-- Read all fields from our email table one record at a time --

                                    $archiveid = trim(odbc_result($row,"archiveID"));
                                    $forename = trim(odbc_result($row,"forename"));
                                    $email = trim(odbc_result($row,"email"));
                                    $archivedescription = trim(odbc_result($row,"archivedescription"));
                                    $archivedate = trim(odbc_result($row,"archivedate"));
                                    $firstreminderdate = trim(odbc_result($row,"firstreminderdate"));
                                    $archiveexpirydate = trim(odbc_result($row,"archiveexpirydate"));
                                    $archivelocation = trim(odbc_result($row,"archivelocation"));
                                    $productfamily = trim(odbc_result($row,"productfamily"));
                                    $mdreport = trim(odbc_result($row,"mdreport"));
                                    $productderivative = trim(odbc_result($row,"productderivative"));
                                    $quantity = trim(odbc_result($row,"quantity"));
                                    $productmodel = trim(odbc_result($row,"productmodel"));
                                    $testreference = trim(odbc_result($row,"testreference"));
                                    $supplier = trim(odbc_result($row,"supplier"));
                                    $component = trim(odbc_result($row,"component"));
                                    $partnumber = trim(odbc_result($row,"partnumber"));
                                    $emailtype = trim(odbc_result($row,"emailtype"));

                                    //-----------------------------------------------------------------


                                    //-----------------------------------------------------------------

                                    //Check to see if we need to send somebody a confirmation email.
                                    if($emailtype == "CONFIRMATION"){

                                        //Send our confirmation email to the intended recipient.
                                        SendArchiveConfirmationEmail($archiveid,$forename,$email,$archivedescription,$archivedate,$archiveexpirydate,$productfamily,$mdreport,$productderivative,$quantity,$productmodel,$testreference,$component,$partnumber,$supplier,$archivelocation);
                                    }

                                    //Check to see if we need to send somebody a retired email.
                                    if($emailtype == "RETIRE"){

                                        //Send retired confirmation email to the intended recipient.
                                        SendRetiredConfirmationEmail($archiveid,$forename,$email,$archivedescription,$archivedate,$archiveexpirydate,$productfamily,$mdreport,$productderivative,$quantity,$productmodel,$testreference,$component,$partnumber,$supplier,$archivelocation);

                                    }


                                    //As we process all records in the email queue, we delete each record once an
                                    //email has been sent above.
                                    $sql = "DELETE * FROM email  WHERE archiveID = $archiveid";

                                    //Delete our email record.
                                    $roww=odbc_exec($conn, $sql);


                                } while (odbc_fetch_row($row));
                            }

    odbc_close($conn); //Close our database
?>
...