Unable to access the Settings page
-
I am using Windows and Google App Engine to run WordPress. When I try to access the ‘Google App Engine for WordPress’ settings page (https://localhost/wp-admin/options-general.php?page=appengine), it returns the following error:-
You do not have sufficient permissions to access this page.
After some debugging, I found the root cause was due to Windows using backslashes for directory path. In wp-includes/vars.php, it has the following line:-
preg_match('#/wp-admin/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches);
In my local server,
$_SERVER['PHP_SELF']
returns “\wordpress\wp-admin\admin.php”, which will not match the above regex due to different slashes. Therefore $self_matches is null and so$pagenow
is incorrectly set to index.php in vars.php. Due to this, calling user_can_access_admin_page() will return false causing the error.I tried to replace the above with:
str_replace('\\', '/', $_SERVER['PHP_SELF'])
And the Settings page displays perfectly.I have tried the same installation running on WAMP without any problems (i.e.
$_SERVER['PHP_SELF']
returns slashes for directory separator), but when my wordpress is running on Google App Engine, it returns backslashes.Is there any suggestions on how to fix this? I think it is more related to Google App Engine itself rather than this pluggin, but I have been searching for a fix for this problem for the entire week without much progress, hope someone can give me some hints on this. Thank you!
- The topic ‘Unable to access the Settings page’ is closed to new replies.