我正在通过在浏览器中提供 URL 来测试本地主机中的 cron 作业。它从 XML 文件中获取记录并存储到数据库中。执行 10 分钟时出现“内部服务器错误”。文件包含 20000 条记录。无法追踪问题。可能是什么问题?
3 回答
In your php.ini ; make php log errors to a file or syslog, then you can get the actual error message.
Documentation for the runtime confirguration, see notably the "error_log" configuration directive.
You need to increase the maximum execution time of your script. This however may not be a good idea if you have many requests and you're using apache. Here's the manual. Good luck!
You can use set_time_limit to set the number of seconds a script is allowed to run. Setting it to zero will turn time limits off. At the top of your PHP script add :
set_time_limit(0)
That will avoid any timeouts.