最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

themes - FTP + Unable to locate WordPress content directory (wp-content)

programmeradmin0浏览0评论

When I try to upload a theme in my Wordpress website I need to fill in FTP credentials.

I've installed vsftpd on my Ubuntu 18.04 server. When I connect with the credentials in my FTP client (ex. Cyberduck on mac) I see the following:

The problem is when I try this in Wordpress I get the error FTP + Unable to locate WordPress content directory (wp-content).. What could be the problem here?

When I try to upload a theme in my Wordpress website I need to fill in FTP credentials.

I've installed vsftpd on my Ubuntu 18.04 server. When I connect with the credentials in my FTP client (ex. Cyberduck on mac) I see the following:

The problem is when I try this in Wordpress I get the error FTP + Unable to locate WordPress content directory (wp-content).. What could be the problem here?

Share Improve this question asked Jun 24, 2019 at 7:28 nielsvnielsv 1731 gold badge5 silver badges17 bronze badges 1
  • You're managing this server on your own, right? Instead of giving WordPress the FTP credentials, I would rather make sure the user PHP/WordPress is running as has access to these files. Usually you can do this by doing sudo chown -R www-data:www-data . – kero Commented Jun 24, 2019 at 8:24
Add a comment  | 

2 Answers 2

Reset to default 2
  • All files should be owned by the actual user's account, not the user account used for the httpd process.
  • Group ownership is irrelevant unless there are specific group requirements for the web-server process permissions checking. This is not usually the case.
  • All directories should be 755 or 750.
  • All files should be 644 or 640. Exception: wp-config.php should be 440 or 400 to prevent other users on the server from reading it.
  • No directories should ever be given 777, even upload directories. Since the PHP process is running as the owner of the files, it gets the owners permissions and - - can write to even a 755 directory.

You can use

chown www-data:www-data  -R * 
find . -type d -exec chmod 755 {} \;  
find . -type f -exec chmod 644 {} \;

you can also trying the following

add_filter('filesystem_method', create_function('$a', 'return "direct";' ));
define( 'FS_CHMOD_DIR', 0751 );
define('WP_TEMP_DIR', ABSPATH . 'wp-content/tmp');

The tmp folder wasn't having the permission and that caused the website plugins from updating.

You might be on one of those servers which move the /wp-content/ directory one level up for security purposes.

Did you ask the hosting provider for these details? Where are you hosted?

UPDATE: Check your wp-config.php file for these details:

define( 'WP_CONTENT_DIR', dirname( __FILE__ ) . '/../wp-content' );
define( 'WP_CONTENT_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/wp-content' );
发布评论

评论列表(0)

  1. 暂无评论