I’m trying to upgrade WordPress version of a blog and it fails. I input FTP info (host, user, pass and type) then I get the message:
Unable to locate WordPress Root directory.
Installation Failed.
This blog is running on Windows 2008 Enterprise host.(If it was up to me, no doubt it would be hosted on a Linux server.) My fisrt thought was that it was happening because the path is E:home<host_username>Web
I can’t install or upgrade plugins from WordPress admin either. Does it happen because it’s hosted on a Windows server?
I’ve set WP_DEBUG to true on wp-config.php and tried to upgrade again. The following message repeated several times:
PHP Notice: Undefined variable: b in E:Home<host_username>Webwordpresswp-adminincludesclass-wp-filesystem-ftpext.php on line 334
PHP Notice: Undefined variable: b in E:Home<host_username>Webwordpresswp-adminincludesclass-wp-filesystem-ftpext.php on line 337
I’ve checked the wp-adminincludesfile class-wp-filesystem-ftpext.php to see what might be wrong on lines 334 and 337. Below is the code from line 334 to 337:
if ( $b['islink'] )
$b['name'] = preg_replace( '/(s*->s*.*)$/', '', $b['name'] );
return &b;
The blog in question only has Akismet 2.5.8 active. Jetpack 2.3.3 is there, but it’s not active. It’s a new blog, started from WP 3.5.2. So definitely plugins must not be the cause of the problem.
And of course I know that I can upgrade WordPress uploading files of the new version over FTP. My point is I want to solve the issue of not being able to upgrade WordPress and install/upgrade plugins from its own admin.
Any ideas on how to fix it?
I’m sure there is another way to fix it, but you could always try to do a fresh install. Make sure you backup your database and theme files, of course, and then just drop them into the new install.
Not the most eloquent solution, but it has worked for me in the past when I couldn’t think of another way.
Have you tried this function?
Then you can get the wp root path like this:
If your Website is running on PHP 7, installing SSH SFTP Updater Support may solve your problem. This plugin works around a PHP 7 bug.