admin管理员组

文章数量:1310532

I have a website where the home page is created in CodeIgniter (www.myweb) and the blogs are created in WordPress as a subdirectory (blog.myweb) and is hosted in AWS. I am trying to update the plugins and WordPress core but after I give FTP credentials, the error is Unable to locate WordPress content directory (wp-content). What should I do.

I have tried setting the permission as per one of the thread here. But no luck.

I have gone through some documentation and tried defining the plugin directory to define( 'WP_PLUGIN_DIR', dirname(__FILE__) . '/blog/wp-content/plugins' ); but no luck here too.

Please advice to resolve the issue.

I have a website where the home page is created in CodeIgniter (www.myweb) and the blogs are created in WordPress as a subdirectory (blog.myweb) and is hosted in AWS. I am trying to update the plugins and WordPress core but after I give FTP credentials, the error is Unable to locate WordPress content directory (wp-content). What should I do.

I have tried setting the permission as per one of the thread here. But no luck.

I have gone through some documentation and tried defining the plugin directory to define( 'WP_PLUGIN_DIR', dirname(__FILE__) . '/blog/wp-content/plugins' ); but no luck here too.

Please advice to resolve the issue.

Share Improve this question edited Feb 15, 2019 at 15:35 butlerblog 5,1013 gold badges26 silver badges43 bronze badges asked Feb 15, 2019 at 12:32 Rony SamuelRony Samuel 1013 bronze badges 1
  • is this a multisite? Sounds like your have an ownership/permissions problem, the correct owner/group/permissions will depend on your server and how it was configured, I would avoid the FTP path for now and focus on getting it to write directly – Tom J Nowell Commented Feb 15, 2019 at 12:45
Add a comment  | 

3 Answers 3

Reset to default 1
  • 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 {} \; 

I tried the following and it worked

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.

This is user’s permission problem !!

step-1 : First open wp-config.php file.

step-2: paste it at the end of the wp-config.php file.

define('FS_METHOD','direct');

step-3: login as (root) username and its password.

step-4: Copy below code and paste it into access console where you have to specify your plugin directory path and then hit enter.

chmod 777 /yourwebsitename/public/wp-content/plugins/

本文标签: errorsUnable to locate WordPress content directory