0
我試圖在Mac上使用XAMPP運行cron作業。我試過下面的命令,但是文件根本就沒有創建。如果我手動運行它,使用localhost/writer/writer.php
,它工作。Cron作業未在XAMPP Mac OS X上運行,但以其他方式運行
我已經看過谷歌和SO,但沒有任何地址或共鳴與我的問題。任何幫助表示讚賞。
的命令嘗試:
* * * * * /Applications/XAMPP/xamppfiles/bin/php /Applications/XAMPP/xamppfiles/htdocs/writer/writer.php
* * * * * php /Applications/XAMPP/xamppfiles/htdocs/writer/writer.php
代碼正在運行用於測試目的。
<?php
$file = 'people.txt';
// Append a new person to the file
$current = "John Smith\n";
// Write the contents back to the file
file_put_contents($file, $current);
?>
請注意,我也嘗試在XAMPP之外運行一個示例cron,方法是:(它工作)。
* * * * * echo 'test' > /Desktop/test.txt
而且,如果我在目錄中,我做「php writer.php
」它的工作原理也是如此。