2013-01-02 24 views
0

嗯,我想運行一個cronjob有一些文件包括但當我通過命令行運行它一直說文件不存在試圖運行一個cronjob與文件包括但當我運行命令行它繼續說有一個錯誤和文件都沒有

這裏是php文件:

include "../includes/common.php"; 
require_once('../anotherfile.php'); 
require_once '../swift/lib/swift_required.php'; 

//some database things 

這裏是命令行我運行:

/usr/local/bin/php /home/xxxxx/public_html/cron/somefile.php

這裏是錯誤我得到:

Warning: include(..includes/common.php): failed to open stream: No such file or directory in /home/xxxxx/public_html/cron/somefilek.php on line 3 
Warning: include(..includes/common.php): failed to open stream: No such file or directory in /home/xxxxx/public_html/cron/somefilek.php on line 3 
Warning: include(): Failed opening '..includes/common.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/xxxxx/public_html/cron/somefilek.php on line 3 
Warning: require_once(..anotherfile.php): failed to open stream: No such file or directory in /home/xxxxx/public_html/cron/somefilek.php on line 4 
Fatal error: require_once(): Failed opening required '..anotherfile.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/xxxxx/public_html/cron/somefilek.php on line 4 

由於某種原因隻字未提swift_required.php

+0

您確定自己沒有輸錯嗎?你錯誤地說:'include(.. includes/common.php)'而不是'include(../ includes/common.php)' –

+0

嵌套是否包含?就像common.php有一個不起作用的包含...我想我可能會讀錯誤的錯誤。 – kevingreen

+0

john我試過兩種方法都沒有工作../,只是.. common.php適用於整個網站,並有一些包括,但他們正常工作 –

回答

1

您需要在侑目錄「posicionate」第一或在包括使用絕對路徑。嘗試將您的命令更改爲:

cd /home/xxxxx/public_html/cron && /usr/local/bin/php /home/xxxxx/public_html/cron/somefile.php 
+0

只有相同的錯誤現在我在那個目錄 –

+0

這太奇怪了......你確定文件的路徑是正確的,你有權限閱讀它嗎? – m4t1t0

+0

的路徑是正確的對,現在大約premission的我得查現在 –

相關問題