将站点移到另一台服务器。将文件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 ...
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句