php – 当文件存在时,为什么crontab会给出“没有这样的文件或目录”错误?

前端之家收集整理的这篇文章主要介绍了php – 当文件存在时,为什么crontab会给出“没有这样的文件或目录”错误?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
在crontab中运行以下作业后,我在/ var / mail / username中的错误消息中收到以下三行…
15 * * * * /Applications/MAMP/htdocs/iconimageryidx/includes/insertPropertyRESI.PHP

错误

/applications/mamp/htdocs/iconimageryidx/includes/insertpropertyRESI.PHP: line 1: ?PHP: No such file or directory
/applications/mamp/htdocs/iconimageryidx/includes/insertpropertyRESI.PHP: line 3: Syntax error near unexpected token `'initialize.PHP''
/applications/mamp/htdocs/iconimageryidx/includes/insertpropertyRESI.PHP: line 3: `require_once('initialize.PHP');

我试图执行的PHP脚本实际上存在,并且我已经确保拼写多次正确.我之前在另一个脚本上运行了一个crontab,它运行得很好……任何想法?

第二&第3个错误来自以下脚本中的第3行(我尝试使用crontab运行的那个):

<?PHP
    require_once('initialize.PHP');
    require_once('insertPropertyTypes.PHP');

    $sDate;
    if(isset($_GET['startDate'])) {
        $sDate = $_GET['startDate'];
    } else {
        $sDate = '';
    }

    $insertResi = new InsertPropertyTypes('Listing',$sDate,'RESI');
?>

当我在浏览器中运行我的脚本insertPropertyRESI.PHP时,它运行得很好????此外,initialize.PHP和insertPropertyTypes.PHP与insertPropertyRESI.PHP位于同一目录中

我在PHP 5.3.5中使用MAMP

thakns的帮助:?

您正在尝试执行没有有效 shebang的脚本.
像这样添加shebang作为脚本的第一行(当然调整路径):
#!/usr/bin/PHP

或者将crontab条目更改为:

15 * * * * /usr/bin/PHP /Applications/MAMP/htdocs/iconimageryidx/includes/insertPropertyRESI.PHP
原文链接:https://www.f2er.com/php/138751.html

猜你在找的PHP相关文章