Showing posts with label "Unable to locate Wordpress plugin directory". Show all posts
Showing posts with label "Unable to locate Wordpress plugin directory". Show all posts

Tuesday, September 30, 2014

Wordpress Woes

I did a dumb thing last week.

I'd been holding back on upgrading my Ubuntu server to 14.04...for good reason:  I was running software versions that weren't compatible with my version of Ubuntu.

Well, I upgraded anyways (after months of holding off).  It broke my web server and also reverted my Wordpress site back a few versions (3.8.x or something like that...I'd been running version 4.0).

That was this past Saturday.  Today is Tuesday afternoon and I'm almost finished restoring the site.

Things that broke:

Wordpress
PSAD
Apache

I'm going to specifically speak to Wordpress now.

This was actually an Apache/Wordpress combination issue.  I believe the version that Apache was upgraded to was 2.4.x.  It changed the default webserver location from /var/www to /var/www/html, which broke a LOT of my content.  The fix was easy:  I moved everything from /var/www to /var/www/html, ensuring the file and directory permissions didn't change.

Then, I found a multitude of issues with my Wordpress site's content:


  1. All image links broke, meaning they wouldn't render, even after moving content to /var/www/html (but I could upload new pictures without issue -- and they'd render).
  2. I couldn't perform upgrades to v4.0 via the GUI.
  3. I couldn't install new plugins.
  4. I couldn't install templates.


First thing I did was upgrade (manually, via CLI) to v4.0.  That cleared up some issues.

Next, I worked on trying to get the plugins to work.  I couldn't install new plugins.  I also couldn't update old plugins to new versions.  The error I would get was, "Unable to locate Wordpress content directory".  I'd also get "Unable to locate Wordpress plugin directory".  What I did was download (via web browser) the "third party host fix" plugin.  I loaded it to my Ubuntu server via SCP.  I then unzipped it, and moved the uncompressed directory to the plugins folder.  It still wouldn't work.  I found that a symlink was missing from /var/lib/wordpress/wp-content/plugins, so I created a new one:

lrwxrwxrwx 1 root root 60 Sep 30 19:48 third-party-host-fix -> /usr/share/wordpress/wp-content/plugins/third-party-host-fix

That's linked to /usr/share/wordpress/wp-content/plugins/third-party-host-fix...that also the directory where the actual plugin content is located.

After I did that, I was able to see the plugin in the UI.  I activated it successfully.  I then tried to update a plugin...I got a different error:  "Wordpress could not create directory".  Ugh...

I found the solution on how to fix that issue at https://help.ubuntu.com/community/WordPress.  I went to /usr/share/wordpress/wp-config.php and edited the following:

Changed:

define('WP_CONTENT_DIR', '/var/lib/wordpress/wp-content');

to read:

define('WP_CONTENT_DIR', '/var/www/wordpress/wp-content');

That fixed the issues of installing or updating templates and plugins.

The only issue I need to resolve now is the image rendering issue, but I think I'll just reload all the images, one at a time (there aren't all that many, I believe).

This was a horrible experience but the benefit was that it got me to delve and fix the issue (vs. just wiping everything and reinstalling the whole distribution).

UPDATE:

New issues --
  1. Can't remove plugins.  Error message:  "Plugin could not be deleted due to an error: Unable to locate WordPress Plugin directory."
  2. Using Photo Gallery plugin - galleries will render but the images will not show within the gallery UI.  I also can't seem to view the images via browser...may be another incorrect coding issue or even a permissions issue.
UPDATE 2:

  1. I've fixed the issue with the Photo Gallery plugin.  I basically dumped the picture back in the directory where the plugin was looking for them (/usr/share/wordpress/wp-content/uploads/photo-gallery).  I hate how hodge-podge this is...crap is everywhere without standardization, but I'm to the point where I just want the site functional again.  I just hope things don't break when I next upgrade Wordpress.
  2. I'll look into the "can't remove plugins" issue tomorrow.