php – 意外令牌附近的Cron语法错误
发布时间:2020-12-13 16:55:28 所属栏目:PHP教程 来源:网络整理
导读:将站点移动到另一台服务器.将文件statistic.php添加到要执行的Сron.只有这个不喜欢的Cron.写错误: /home/site/www/statistic.php: line 1: ?php: No such file or directory/home/site/www/statistic.php: line 2: syntax error near unexpected token `"b
将站点移动到另一台服务器.将文件statistic.php添加到要执行的Сron.只有这个不喜欢的Cron.写错误:
/home/site/www/statistic.php: line 1: ?php: No such file or directory /home/site/www/statistic.php: line 2: syntax error near unexpected token `"bd.php"' /home/site/www/statistic.php: line 2: `include ("bd.php"); 有我的代码 <?php include ("bd.php"); $result = mysql_query("SELECT MAX(id) FROM statistic_dep",$db); $myrow1 = mysql_fetch_array($result); $last_id=$myrow1[0]; ... 解决方法
确保您将脚本作为php脚本而不是bash脚本执行.
你的crontab应该是这样的: * * * * * /usr/bin/php -f /path/to/file.php 另一种以php的形式执行脚本的方法是在第一行添加一个shebang: #!/usr/bin/php <?php ... (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |