繁体   English   中英

无法在MacOS Local中安装/更新插件Wordpress

[英]Can't install/update plugin wordpress in macos local

我正在使用macOS的默认Apache。 我的wp网站无法安装新插件或更新插件。 但这在现场站点中正常工作 这些是我尝试安装新插件时看到的列表错误:

错误通知: 安装失败:内部服务器错误

立即安装按钮状态: 更新失败!

在控制台调试中,我看到: ... / wp-admin / admin-ajax.php 500(内部服务器错误)

我尝试搜索并以某种方式执行操作,例如:更改chown,对777的权限,添加define('FS_METHOD','direct'),更改memory_limit ...但仍然无法正常工作。

所以我经历了一下,然后看到在@set_time_limit( 300 );行中进行@set_time_limit( 300 ); 在文件.../wp-admin/includes/class-wp-upgrader.php第450行,我看到它正在工作。 但是我不明白为什么会这样?

public function install_package( $args = array() ) {
    global $wp_filesystem, $wp_theme_directories;

    $defaults = array(
        'source' => '', // Please always pass this
        'destination' => '', // and this
        'clear_destination' => false,
        'clear_working' => false,
        'abort_if_destination_exists' => true,
        'hook_extra' => array()
    );

    $args = wp_parse_args($args, $defaults);

    // These were previously extract()'d.
    $source = $args['source'];
    $destination = $args['destination'];
    $clear_destination = $args['clear_destination'];

    //@set_time_limit( 300 ); **If I comment at here it's working**

    if ( empty( $source ) || empty( $destination ) ) {
        return new WP_Error( 'bad_request', $this->strings['bad_request'] );
    }
    $this->skin->feedback( 'installing_package' );
....
}

谁能建议我如何解决这个问题?

谢谢

为了保护Web服务器免受滥用, 对PHP脚本可以运行多长时间设置时间限制 例如,如果您的服务器收到100个没有时间限制的请求,则它们可能永远运行并占用整个RAM。

本地计算机的问题是插件安装的执行时间大于300秒(5分钟)。 它可能是由Internet速度或Apache引起的。

有3种解决方案:

选项1:

注释掉@set_time_limit( 300 ); 与您一样,但不要在生产中更新文件。

选项2:

将此行添加到wp-config.php

ini_set('max_execution_time', 0);

与选项1相同,因此请勿在生产时更新文件。

选项3:

使用更好的本地开发环境(推荐),例如VCCW

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM