이 스크립트는 하나의 서버 (VPS WHM)에서 cronjob을 통해 실행되었으며 동일한 유형의 VPS와 WHM을 가진 다른 호스트로 모든 것을 복사했습니다. 이 스크립트는 새 서버에서 실행되지 않고 전자 메일이 전송되지 않습니다. 나는 공급자와 문제를 해결하려고 노력했으나 손실에 처해있다. 내 질문은 그와 같은 문제를 일으킬 수있는 설정은 무엇인가? 나는 거의 아무런 결과도없이 서버의 모든 설정을 어지럽히고 있습니다. 이 정보를 추적하는 데 도움이되는 정보는 알려 주시면 질문을 수정하겠습니다. 당신이 도움이 될 것이라는 추측을한다면, 나는이 문제에 대해 새로운 시각을 찾고 있습니다.하나의 서버에서 Cronjob을 실행하지만 비슷한 서버에서는 실행되지 않는 PHP 스크립트
추가 정보 :
아파치 버전 2.2.27 PHP 버전 5.4.31 MySQL 버젼 5.5.40-CLL
크론은 로그에 오류 : 10 4 * * PHP의 /home/xxxxx/public_html/alert.php는
또한 시도 : 104 * * * /home/xxxxx/public_html/alert.php
#!/usr/bin/php
<?php
$db_host = "localhost";
$db_username = "xxxx";
$db_pass = "xxxx";
$db_name = "xxxxxx";
mysql_connect("$db_host","$db_username","$db_pass") or die(mysql_error());
mysql_select_db("$db_name") or die ("no database");
$headers = "Bcc: [email protected]";
$tierasql = "SELECT date,phonenumber,email, SUM(dataplan) AS currentplantiera, SUM(datamb) AS value_sumtiera FROM maindata2 WHERE dataplan BETWEEN 2 and 50 and dataplan != '20' GROUP BY email";
$resulttiera = mysql_query($tierasql);
while ($rowtiera = mysql_fetch_assoc($resulttiera)){
if ($resulttiera){
$rowtiera = mysql_fetch_assoc($resulttiera);
$plantiera = $rowtiera['currentplantiera'] ;
$date = $rowtiera['date'] ;
$inventorytiera = ROUND ($rowtiera["value_sumtiera"],2) ;
$recipienttiera = $rowtiera['email'];
if ($inventorytiera > (.75 * $plantiera)){
$msgtiera = "Xxxxxxxxx Data Usage Alert:
This alert is being provided to you because your lines in Tier A have exceeded 75% of your Xxxxxxxxx Service Plan.
As of $date, your current data usage is $inventorytiera MB and you have a data allotment of $plantiera MB of shared data.
Please note that you may experience overage charges if your total data usage exceeds the net total usage of all data in the same sharing tier until your usage is reset on your next billing cycle.
One upward rate plan adjustment is allowed per billing cycle, please visit http://xxxxxxxxx.com/rate-plan-change for more details.
Please refer to Xxxxxxxxx.com/data to review your data usage.";
mail($recipienttiera,"[email protected]", "Xxxxxxxxx Data Usage Alert", $msgtiera, $headers);
}
}
else {
$msg = "An error occurred: " . mysql_error();
mail($recipienttiera,"[email protected]", "Alert from Xxxxxxxxx error", $msgtiera, $headers);
}
}
$tierbsql = "SELECT date,phonenumber,email, SUM(dataplan) AS currentplantierb, SUM(datamb) AS value_sumtierb FROM maindata2 WHERE dataplan BETWEEN 500 and 8000 GROUP BY email";
$resulttierb = mysql_query($tierbsql);
while ($rowtierb = mysql_fetch_assoc($resulttierb)){
if ($resulttierb){
$rowtierb = mysql_fetch_assoc($resulttierb);
$plantierb = $rowtierb['currentplantierb'] ;
$date = $rowtierb['date'] ;
$inventorytierb = ROUND ($rowtierb["value_sumtierb"],2) ;
$recipienttierb = $rowtierb['email'];
if ($inventorytierb > (.75 * $plantierb)){
$msgtierb = "Xxxxxxxxx Data Usage Alert:
This alert is being provided to you because your lines in Tier B have exceeded 75% of your Xxxxxxxxx Service Plan.
As of $date, your current data usage is $inventorytierb MB and you have a data allotment of $plantierb MB of shared data.
Please note that you may experience overage charges if your total data usage exceeds the net total usage of all data in the same sharing tier until your usage is reset on your next billing cycle.
One upward rate plan adjustment is allowed per billing cycle, please visit http://xxxxxxxxx.com/rate-plan-change for more details.
Please refer to Xxxxxxxxx.com/data to review your data usage.";
mail($recipienttierb,"[email protected]", "Xxxxxxxxx Data Usage Alert", $msgtierb, $headers);
}
}
else {
$msg = "An error occurred: " . mysql_error();
mail($recipienttierb,"[email protected]", "Alert from Xxxxxxxxx error", $msg, $headers);
}
}
$tiercsql = "SELECT date,phonenumber,email, SUM(dataplan) AS currentplantierc, SUM(datamb) AS value_sumtierc FROM maindata2 WHERE dataplan BETWEEN 10000 and 100000 GROUP BY email";
$resulttierc = mysql_query($tiercsql);
while ($rowtierc = mysql_fetch_assoc($resulttierc)){
if ($resulttierc){
$rowtierc = mysql_fetch_assoc($resulttierc);
$plantierc = $rowtierc['currentplantierc'] ;
$date = $rowtierc['date'] ;
$inventorytierc = ROUND ($rowtierc["value_sumtierc"],2) ;
$recipienttierc = $rowtierc['email'];
if ($inventorytierc > (.75 * $plantierc)){
$msgtierc = "Xxxxxxxxx Data Usage Alert:
This alert is being provided to you because your lines in Tier B have exceeded 75% of your Xxxxxxxxx Service Plan.
As of $date, your current data usage is $inventorytierc MB and you have a data allotment of $plantierc MB of shared data.
Please note that you may experience overage charges if your total data usage exceeds the net total usage of all data in the same sharing tier until your usage is reset on your next billing cycle.
One upward rate plan adjustment is allowed per billing cycle, please visit http://xxxxxxxxx.com/rate-plan-change for more details.
Please refer to Xxxxxxxxx.com/data to review your data usage.";
mail($recipienttierc,"[email protected]", "Xxxxxxxxx Data Usage Alert", $msgtierc, $headers);
}
}
else {
$msg = "An error occurred: " . mysql_error();
mail($recipienttierc,"[email protected]", "Alert from Xxxxxxxxx error", $msg, $headers);
}
}
$sql = "SELECT date,phonenumber,email, dataplan AS currentplan, SUM(datamb) AS value_sum FROM maindata2 GROUP BY phonenumber, dataplan";
$result = mysql_query($sql);
if ($result) {
while ($row = mysql_fetch_assoc($result)){
$plan = $row['currentplan'] ;
$date = $row['date'] ;
$inventory = ROUND ($row["value_sum"],2) ;
$recipient = $row['email'];
$line = $row['phonenumber'];
if ($inventory > (.75 * $plan)) {
$msg = "Xxxxxxxxx Single Line Usage Alert:
This alert is being provided to you because your line $line has exceeded 75% of it's Xxxxxxxxx Service Plan.
As of $date, your current data usage is $inventory MB of your $plan MB data plan.
Please note that you may experience overage charges if your total data usage exceeds the net total usage of all data in the same sharing tier until your usage is reset on your next billing cycle.
One upward rate plan adjustment is allowed per billing cycle, please visit http://xxxxxxxxx.com/rate-plan-change for more details.
Please refer to Xxxxxxxxx.com/data to review your data usage.";
mail($recipient,"[email protected]", "Alert from Xxxxxxxxx", $msg, $headers);
}
}
}
else {
$msg = "An error occurred: " . mysql_error();
mail($recipient,"[email protected]", "Alert from Xxxxxxxxx error", $msg, $headers);
}
?>
어떤 버전의 php가 설치되어 있습니까? – baao
Apache 버전 \t 2.2.27 PHP 버전 \t 5.4.31 MySQL 버전 \t 5.5.40-cll – user3688183