简体   繁体   中英

WordPress 3.8: unable to locate wordpress content directory (wp-content)

I had my server setup just fine to allow me to update plugins, themes, and the core via the nice buttons WordPress provides. However, after upgrading to 3.8 I have not been able to upgrade anything. However, I also added iptables to the server around the same time but I don't think this is the issue - I shut off iptables and tried but didn't have any success.

When I attempt to upload the plugin/update via WordPress's FTP it can't connect via localhost. Both 127.0.0.1 and the public IP return the "unable to locate wordpress content directory (wp-content)" after a long, long time suggesting a timeout or several timeouts.

Environment:

  • WP 3.8 (multisite, subdirectory)
  • Ubuntu 12.04 server
  • vsftpd (so I can FTP my user)
  • Way back when (when I didn't know what I was doing) I changed the whole /var/www/ directory permissions to gabe:gabe. I have since tried changing the wp-content dir to gabe:www-data and www-data:www-data without success. I have also tried using chmod 777 on wp-content, again without success.

I have googled and the vast majority of the fixes come down to permissions. However, as I stated above I've tried changing the owner and the permissions to 777 for the directory. So, I think permissions is a dead end.

I originally thought iptables was somehow getting in the way. But I've shut it off/flushed the table without success. So I don't think iptables is the culprit.

The other googled solutions amounted to adding some code to the wp-config.php file. However, one of those broke the site entirely. Another had no effect.

The logs for Apache and the domain show nothing. They aren't empty but there isn't a single reference to wp-content or anything I can think of that would be related. The ftp logs show that a connection was successfully established via 127.0.0.1.

So I've used up my bag of tricks at this point.

------------- Edit: Alterations I made to wp-config ------------- Per http://wordpress.org/support/topic/unable-to-locate-wordpress-content-directory-wp-content I changed the wp-config.php to include:

if(is_admin()) {
    add_filter('filesystem_method', create_function('$a', 'return "direct";' ));
    define( 'FS_CHMOD_DIR', 0751 );
}

This was a solution presented for the same problem back in WordPress 2.8 some 4 yrs ago. The site wouldn't load after adding these lines and given the age of the post/solution I took them out and did no further troubleshooting on why the site wouldn't load. I assumed it was calling some function that wasn't present in WP any longer.

The second piece of code I added to wp-config.php was:

putenv('TMPDIR='. ABSPATH .'tmp');
define('WP_TEMP_DIR', ABSPATH . 'tmp');

Per http://wordpress.org/support/topic/unable-to-locate-wordpress-content-directory-wp-content?replies=15 . This didn't break the site but didn't fix it either so I removed it.

Adding this line to my wp-config.php worked.

define('FS_METHOD', 'direct');

I have a local development environment on an Ubuntu server.

Try adding this line into your wp-config.php, it works for me

define('FS_METHOD', 'ftpsockets');
define('FTP_BASE', 'xxx');

Replace the xxx with your ftp home path eg /opt/htdocs/wordpress

Try this one:)

//* FTP Settings **/
/** wp-content path */
define('FS_METHOD', 'ftpext');
define('FTP_BASE', '/');
define('FTP_CONTENT_DIR', '/wp-content/');
define('FTP_PLUGIN_DIR', '/wp-content/plugins/');
define('FTP_USER', 'testdomain4.com');
define('FTP_PASS', 'XXXXXXXXXXXX');
define('FTP_HOST', 'ftp.enterpriseit.us');
define('FTP_SSL', false);

see http://codex.wordpress.org/Editing_wp-config.php

Points to check (If you have not already): 1. Check if you are able to login using FTP client. 2. Whether it is changing the folder to WP folder when ftp user logs in.

Some points which may help you in cross checking your settings:

You may have to create a ftp user whose home folder is your WP installation.

When WordPress logs in to FTP, it should the home folder of WP installation.

Check this URL, this will help you.

http://blog.noizeramp.com/2008/09/10/wordpress-unable-to-locate-wordpress-plugin-directory/

If you are not sure how to create user or assign home folder, there are many sites which explain.

Below is one of them:

http://www.cyberciti.biz/faq/howto-change-default-home-directory/

After creating user, make changes in wp-config.php as below.

define( 'FTP_USER', 'username' );
define( 'FTP_PASS', 'password' );
define( 'FTP_HOST', 'ftp.example.org:21' );

Goodluck!

on a debian based system, after wordpress installation from debian packages, i had to change the owner and group of directorys from "root" to "www-data" in /var/lib/wordpress/wp-content/ eg.

sudo chown www-data:www-data /var/lib/wordpress/wp-content/ -R

to make the directorys writable for the webserver.

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