简体   繁体   中英

WP4.1 - plugin-install.php gives “You do not have sufficient permissions to access this page.”

See the fix at the end of the post

Problem is plugins can no longer be updated/installed through the admin dashboard. The dashboard itself can be accessed and is mostly functional - except for plugin update/install (also no wordpress update entries). I have little knowledge of prior history of the site, as the problem was given to me after the fact.

I am pretty sure the filesystem permissions (linux host) are OK. Tried to remove all plugins (renamed the directory) and .htaccess, to no avail. However, the plugin better-wp-security is installed and I have come to suspect that some of the changes it did in the db (there is very little in wp_config.php, except the prefix change) may be the culprit. The webserver (apache) logs show a 500 error when plugin-install.php is invoked:

192.168.0.1 - - [21/Jan/2015:12:56:52 +0100] "GET /wp-admin/themes.php?page=install-plugins HTTP/1.1" 500 1351 "http://xxx.yyy.zzz/wp-admin/" "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36"    

error_log is clear. No errors show up in correspondence of the 500 shown. Actually, very few errors show up in error_log, even with log_errors=On. php.ini has:

error_reporting = E_ALL & ~E_DEPRECATED
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
track_errors = Off
html_errors = Off
mssql.min_error_severity = 10

I could get no more info even setting wp's debug flag to true.

I have manually reinserted an ID 1 user (which wp-better-admin had removed) with no changes. DISALLOW_FILE_EDIT is not defined.

What now?

EDIT: TL,DR: Installed a fresh wordpress, it works. Do not install wordpress from your OS package manager. Use the wordpress.com tarball.

The machine I was working on is a Centos6 server. Wordpress was installed from the EPEL repository - which appeared the sensible thing to do because dependencies, blah blah. NOT. In an attempt to avoid package updates from the dashboard, the packager modified the sources in a way that is asinine enough to:

  1. also inhibit plugin installs/update
  2. do so without giving any hint whatsoever of what was going on
  3. have the behavior change in a standard update

Hence the snafu. The toool wp-cli,( https://trepmal.com/2014/02/22/getting-started-with-wp-cli/ ) with its core verify-checksums command was instrumental to the solution - highly reccomended.

Ok, a 500 error is something bad. Apache is letting you know that PHP did something so bad that it can't recover.

The first thing that comes to mind is that your security plugin has changed permissions on a directory like wp-content/uploads or wp-content/plugins . Can you upload themes?

Here are a couple of generic suggestions.

0: backup your database and your wp-content/uploads directory. Backup any custom themes and plugins as well. Put them somewhere safe.

1: Your php.ini settings above don't show where errors are logged to. Sometimes it's the Apache error log, other times it's /var/log/messages Make sure you are looking in the right place.

2: Reinstall WordPress over the top of your existing site. Manually overlaying the core shouldn't hurt anything. It could be that you've got a corrupt PHP file in there (I've had it happen) or some modification to core that is causing the problem. (Unlikely)

3: If it's still throwing a 500 and you can't see where then try this as a last-ditch effort

  • Go to http://getpantheon.com/register and setup a free account. (No creditcard needed. Yes, I work for them, no this isn't an ad for them.)
  • Setup a WordPress site as a sandbox
  • One by one install your themes and plugins. Test between each install.

    d: if it's still not malfunctioning, import your database. This is tricky but it sounds like you are a developer, so you can figure it out. I use Sequel Pro on OSX for all my DB work. You will also need to download and use Pantheon's cli tool ( https://github.com/pantheon-systems/cli ) so you can update your database with the correct URLS)

Now #3 is a lot of work. On my personal blog, it takes me about 15 minutes to do it but I've done it so many times I can do it in my sleep. Expect it to take you 60-90 minutes to get it done, depending on the size of your site.

If your site works correctly in the sandbox then that's a puzzler. At that point, as much of a pain in the rear as it is, i would:

  • Make a backup of EVERYTHING Delete EVERYTHING on your server (Well, everything dealing with this site)
  • Reinstall one at a time until it is either working properly, or it is erroring again.

HTH,

=C=

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM