2014-06-09 73 views
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”它的工作原理也是如此。

回答

0

我找到了解决方案。这是我的愚蠢,是的,最好的愚蠢。

该文件正在输出根目录,并验证,我没有检查cd ~/

它就是我的档案。