1
我有一個cron作業運行每1分鐘發送推送消息到手機。file_put_contents在cron作業中無法正常工作
1.I執行讀取數據庫中查詢得到,我需要發送
2.採用的數據陣列I執行另取查詢中的所有郵件。 我使用file_put_contents將數據寫入某個文件。
3.然後我使用一些服務發送推送消息。
消息成功接收,但數據沒有寫入文件(我在第二點)。
注意:當我在本地機器上手動運行此文件時,此代碼完美運行。
我發現
有人建議我說,你的mysql正在執行查詢腳本的速度慢等其他行之前執行等錯誤。
守則
Sone database query that will give customer ids in $customer_ids array
$customer_ids = array_unique($customer_ids);
foreach ($customer_ids as $customer_id){
//Problem is here.file is written here using file_put_contents (this does not work-file does not update)
PushMessage_Model_Mapper_PushMessage::getPublishfile($customer_id);
}
foreach ($customer_ids as $customer_id){
//push messages are send by calling some function
}
是否有這樣的行爲存在任何已知問題。
是的,它擁有所有權限。我們嘗試通過cron作業將虛擬數據記錄到文件中。 –
在一個文件中記錄cronjob的輸出,也許腳本會拋出錯誤 – schokocappucino
會嘗試......謝謝:) –