Monday, July 2, 2018

To perform the requested action, WordPress needs to access your web server

If you recently installed a fresh copy of Wordpress on your server and tried to install a new theme or a new plugin you might saw the following message:

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.


Wordpress has a setting called FS_METHOD. FS method defines the file system method for Wordpress. The value for FS_METHOD can be any of the following options:
  • direct
  • ssh2
  • ftpext
  • ftpsockets
Direct is the default value for FS_METHOD. However, you or your developer may changed this in the past. My first recommendation is to look for FS_METHOD in wp-config.php. wp-config.php is located in the main directory of your Wordpress website. If you find the FS_METHOD set the value of that to direct and try to install a theme or plugin.

Permission Issue

If you followed the previous steps and either you didn't find FS_METHOD in your wp-config or your FS_METHOD is set to direct and still you are not able to install a plugin/theme then you might have file permission issue.
Usually, when there is a permission issue you will get a different message:

Installation failed: Could not create directory.
In this scenario, you need to adjust the file system permissions on your server. For doing this step you need to have SSH access to the server.

  • First, connect to your server using SSH command.
  • Then, you need to figure out what user Apache server is running as. Run the following command to get the apache user:
  • ps aux | egrep '(apache|httpd)'
  • In this example, my Apache is running as www-data
  • Next, run the following command (Replace /var/www/html with your site root directory. Replace www-data with your Apache user):
  • sudo chown -R www-data /var/www/html
Chown command will change the owner of the root directory and will fix the permission issue. Now PHP(Wordpress) should be able to create a directory. Now can try to install your plugin/theme.

Social Networks Sharing