I setup a self-signed certificate with NGINX with the following fastcgi_params:
fastcgi_pass_header Authorization; <=throws undefined index error
and
fastcgi_param PHP_AUTH_USER $remote_user; <= value is NULL
fastcgi_param PHP_AUTH_PW $http_authorization; <= value is NULL
I believe these will only work if you authenticate against NGINX.
Sorry to say this is still not working for me.
Well, it seems that Basic Authorization isn’t needed for the loopback requests. It is merely one of many possible authentications that WordPress will attempt to allow the edit to save.
From what I can tell there are two issues with wp-admin/includes/file.php and the ability to edit PHP files as the Network Admin. The first is that WP does an SSL verification even on links that are on the same host. If you are using a self-signed certificate, this will fail unless you turn off sslverify. I’m still looking into the best way to do this as I want remote verification, but want to disable verifications to the hosts own IP addresses.
The 2nd issue seems to be that the network admin url isn’t being used when creating the URL for the loopback request. Access logs were showing a 302 as the loopback attempted to request from /wp-admin/theme-editor.php rather than /wp-admin/network/theme-editor.php
after putting this in place, PHP file editing started working:
File.php
if ( $plugin ) {
if ( is_multisite() ) {
$url = add_query_arg( compact( ‘plugin’, ‘file’ ), admin_url( ‘network/plugin-editor.php’ ) );
} else {
$url = add_query_arg( compact( ‘plugin’, ‘file’ ), admin_url( ‘plugin-editor.php’ ) );
}
} elseif ( isset( $stylesheet ) ) {
error_log(‘editing theme’);
if ( is_multisite() ) {
$url = add_query_arg(
array(
‘theme’ => $stylesheet,
‘file’ => $file,
),
admin_url( ‘network/theme-editor.php’ )
);
} else {
$url = add_query_arg(
array(
‘theme’ => $stylesheet,
‘file’ => $file,
),
admin_url( ‘theme-editor.php’ )
);
}
} else {
$url = admin_url();
}
What I don’t understand is how editing PHP files isn’t broken on every Multisite installation as I seem to be the only one raising this issue?
Mike