PHP 警告: strpos(): 第 353 行 D:\Hosting\110000\html\xxxx\w



当单击工具中的网络设置时,我尝试在我的站点中安装多站点:

我得到: PHP 警告: strpos(): 第 353 行 D:\Hosting\110000\html\xxxx\wp-admin\includeetwork.php 中的空针

/**
* Prints step 2 for Network installation process.
*
* @since 3.0.0
*
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param WP_Error $errors
*/
function network_step2( $errors = false ) {
global $wpdb;
$hostname          = get_clean_basedomain();
$slashed_home      = trailingslashit( get_option( 'home' ) );
$base              = parse_url( $slashed_home, PHP_URL_PATH );
$document_root_fix = str_replace( '\', '/', realpath( $_SERVER['DOCUMENT_ROOT'] ) );
$abspath_fix       = str_replace( '\', '/', ABSPATH );
$home_path         = 0 === strpos( $abspath_fix, $document_root_fix ) ? $document_root_fix . $base : get_home_path();
$wp_siteurl_subdir = preg_replace( '#^' . preg_quote( $home_path, '#' ) . '#', '', $abspath_fix );
$rewrite_base      = ! empty( $wp_siteurl_subdir ) ? ltrim( trailingslashit( $wp_siteurl_subdir ), '/' ) : '';

$location_of_wp_config = $abspath_fix;
if ( ! file_exists( ABSPATH . 'wp-config.php' ) && file_exists( dirname( ABSPATH ) . '/wp-config.php' ) ) {
$location_of_wp_config = dirname( $abspath_fix );
}
$location_of_wp_config = trailingslashit( $location_of_wp_config );

第 353 行:

$home_path         = 0 === strpos( $abspath_fix, $document_root_fix ) ? $document_root_fix . $base : get_home_path();

WordPress文件不在根文件夹中,而是在子目录中,我正在使用的域指向该子目录。

如何添加wordpress多站点网络?

任何知道如何解决这个问题。

请帮忙。

脚本的屏幕截图

有一个小链条可以遵循:

$document_root_fix.
部分创建$_SERVER['DOCUMENT_ROOT']

我猜$_SERVER['DOCUMENT_ROOT']没有设置或为空。
如果是这种情况,那可能是阿帕奇的错。如何安装多站点?通过网站还是您使用诸如wp-cli之类的工具?

一个肮脏的解决方案是对此修复程序进行硬编码。

$home_path = get_home_path();

!!安装后请务必将其更改回来!!

最新更新