如何在MAMP上运行后台php进程?

时间:2013-04-17 08:45:56

标签: php mamp background-process

我正在尝试使用以下代码在MAMP上触发后台php进程:

exec("php /Users/Joe/sandbox/getnew.php?artist=".$artistID." > error_log &");

或:

shell_exec("nohup /usr/bin/php /Users/Joe/sandbox/getnew.php?artist=".$artistID." > error_log &");

即使使用php文件的直接路径,它似乎也没有触发?当它被触发时,它将从API收集一些信息并将其写入数据库。

1 个答案:

答案 0 :(得分:1)

你是否尝试过这样的事情:

exec("php /Users/Joe/sandbox/getnew.php?artist=".$artistID, $output);

之后:

file_put_contents($file, implode("\n", $output), FILE_APPEND)
相关问题