Enter your FTP credentials
The enter your FTP credentials error manifests in a number of ways and can be caused by a number of things. 80% of the time it’s a permission error somewhere. There are many articles on the Internet about this error but all of them neglect the fact that the permission error maybe with the webserver.
Most articles tell users to add something to the wp-config.php file and define a temporary directory. None of them goes into details about PHP, handlers and user permissions. In this guide, we are going to perform a checklist to find why this and other errors happen and fix them.
Error’s That Occur due to permissions
You might see one of the following errors that would indicate a permission error;
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.
Download failed. Destination directory for file streaming does not exist or is not writable.
These could happen when you are installing plugins or updating WordPress and themes. Basically any time WordPress downloads something to its location.
define( ‘FS_METHOD’, ‘direct’ );
Many guides state to add define( ‘FS_METHOD’, ‘direct’ ); into the wp-config.php file. This allows the user to create files in the WordPress location. However this is useless if the servers PHP settings are incorrect.
define( ‘FS_METHOD’, ‘direct’ );
Define Temporary Folder
Other posts advise defining a temporary location for files to download to. Again if your WordPress install was working fine this is totally useless it’s very unlikely your current temporary folder permissions have been changed. You can try to add a new temporary folder above the public_html folder and chmod it to 0777. Add the following code to the wp-config.php file;
define('WP_TEMP_DIR', ABSPATH . '/../tempwp/');
Check the current owner & permissions
If you have root access to the server you can check the current owner and permissions using stat. Servers using suPHP as PHP handler then PHP will be expecting the file to be owned by the user and the group will also be the user. If the server is running CGI then the file will be owned by the user but the group will be nobody. If you only have a Web Hosting account you can’t complete the rest of this guide and your host will need to complete the rest of the work. Migrate to our PCIe NVMe Web Hosting for speed that will blow you away.
Below is an example server running suPHP. We have run stat on the wp-content folder
CT-4443 stat /home/blog/public_html /wp-content/ File: /home/blog/public_html /wp-content / Size: 4096 Blocks: 8 IO Block: 4096 directory Device: 5950b6e1h/1498461921d Inode: 1445064 Links: 7 Access: (0750/drwxr-x---) Uid: ( 1011/ blog) Gid: ( 99/ nobody) Access: 2020-08-29 12:50:31.742412196 +0100 Modify: 2020-08-29 13:02:56.029591988 +0100 Change: 2020-08-29 13:02:56.029591988 +0100 Birth: -
Notice the following line;
Access: (0750/drwxr-x---) Uid: ( 1011/ blog) Gid: ( 99/ nobody)
The group or GID for the wp-content folder is assigned to nobody but this is a suPHP server so the wp-content folder should be assigned to the user and the group should also be the user.
This is why WordPress cannot download files to the install. It does not have permission to create files or folders due to the wrong group.
In an SSH console, we can chown the folder to correct the group. We do this by specifying the cPanel user name
chown blog.blog /home/blog/public_html/wp-content
Replace blog.blog with your cPanel username and ensure the path to the wp-content folder is correct. When you run stat again you will notice the group is now corrected and the permission errors should be resolved.
CT-4443 / stat /home/blog/public_html/wp-content File: '/home/blog/public_html/wp-content' Size: 4096 Blocks: 8 IO Block: 4096 directory Device: 5950b6e1h/1498461921d Inode: 3279999 Links: 11 Access: (0755/drwxr-xr-x) Uid: ( 1013/ blog) Gid: ( 1014/ blog) Access: 2020-08-29 17:47:07.924060686 +0100 Modify: 2020-08-29 20:41:23.865183619 +0100 Change: 2020-08-29 20:41:23.865183619 +0100 Birth: -
For an automated way to check file permissions and folder permissions check out our guide to automatically fixing permissions.
How was this article – Please enter your FTP credentials
You might also like
More from Reseller Web Hosting
When using Cloudflare there are some easy things you can do to help prevent abuse on your WordPress website. Malicious …
Host WebsitescPanel allows you to host websites by using a GUI or graphical user interface to manage your website. Used …