dqp21271 2016-05-02 11:07
浏览 126
已采纳

Wordpress导入程序错误:最长执行时间60秒

I am trying to import a Wordpress theme unit test xml with default wordpress importer plugin. I get following error:

Fatal error: Maximum execution time of 60 seconds exceeded in E:\XAMPP\htdocs\wp\wp-includes\wp-db.php

This is a basic Wordpress 4.5.1 installation with no additional plugins or themes, except wordpress importer v 0.6.1, on my local XAMPP server, execution time limit is set to 6000 in php.ini and I can see this preset in xampp's php_info. I've already tried adding set_time_limit(6000) in wp-config.php and wp-db.php with the same ugly error as result.

Any ideas why is this happening and how can it be helped?

  • 写回答

5条回答 默认 最新

  • dqkyz02602 2016-05-11 08:22
    关注

    I found the precise reason why this error happens, so I'll try to provide the answer to my own question.

    There is a function called wp_get_http in wp-includes/deprecated.php, which is still used by the wordpress importer plugin (inside wordpress-importer.php source file). Inside this function set_time_limit(60) is called, it is the one of exactly two calls to this function with parameter 60 in all the wordpress source code, so this is the place that limits importer execution time to 60 seconds.

    wp_get_http is called by importer plugin rather late in the execution flow, so it overrides any other possible set_time_limit() calls in wp-config.php, and cannot be corrected by modifications in php.ini, which on their own may happen to be not allowed by hosting provider.

    The quick solution to this, which worked for me, is to modify the set_time_limit call inside wp_get_http() in wp-includes/deprecated.php, like this:

    set_time_limit(1200); // Limit to 20 minutes
    

    It gives the wordpress importer 20 minutes to fetch all the remote files it may require during import. May be this is not the safest solution, but it worked for me.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?