此脚本大致概述了服务器上允许/安装的文件系统方法。前三种方法是WordPress首选的方法,WordPress可以通过定义FS_METHOD
在wp-config.php
.
将代码复制到文件中,将文件上载到服务器,检查允许/安装哪些文件系统方法,并尽快删除该文件。
<?php
$yes = \'<span style="color:green; font-weight:bold">:)</span>\';
$no = \'<span style="color:red; font-weight:bold">:(</span>\';
$items = array();
$items[\'fopen\'][0] = \'Opening urls via fopen (for FS_METHOD "direct")\';
$items[\'fopen\'][1] = ( TRUE == ini_get( \'allow_url_fopen\' ) ) ?
\' is allowed \'.$yes : \' is not allowed \'.$no;
$items[\'ssh2\'][0] = \'SSH2 (for FS_METHOD "ssh")\';
$items[\'ssh2\'][1] = ( TRUE === extension_loaded( \'ssh2\' ) ) ?
\' is installed \'.$yes : \' is not installed \'.$no;
$items[\'ftp\'][0] = \'FTP (for FS_METHOD "ftpext")\';
$items[\'ftp\'][1] = ( TRUE === extension_loaded( \'ftp\' ) ) ?
\' is installed \'.$yes : \' is not installed \'.$no;
$items[\'sockets\'][0] = \'Sockets (for FS_METHOD "ftpsockets")\';
$items[\'sockets\'][1] = ( TRUE === extension_loaded( \'sockets\' ) ) ?
\' are installed \'.$yes : \' are not installed \'.$no;
$items[\'curl\'][0] = \'Curl\';
$items[\'curl\'][1] = ( TRUE === extension_loaded( \'curl\' ) ) ?
\' is installed \'.$yes : \' is not installed \'.$no;
echo \'<html>\';
echo \'<ol>\';
foreach ( $items as $item ) {
printf( \'<li>%s%s</li>\', $item[0], $item[1] );
}
echo \'</ol>\';
echo \'</html>\';
您可以通过在
wp-config.php
, e、 g.使用php ftp扩展,而不是
fopen
:
if ( ! defined( \'FS_METHOD\' )
define( \'FS_METHOD\', \'ftpext\' );
如果您在使用文件系统方法时遇到问题,并且希望使用另一种方法,这可能会很有帮助。