Menu Close

How To Fix “Unable to connect to the filesystem. Please confirm your credentials” In WordPress

default

If you are running XAMPP on localhost using OS X then you may have encountered one of the following errors:

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.

Unable to write to wp-config.php file.

The first error you may find will occur when uploading a plugin or theme. The third error you will notice when you are trying to install WordPress.

Both errors are caused by the same issue, this is because the default XAMPP user is set to daemon on Mac which causes the permission issues. WordPress tries to write files prior to upgrading and will check which user tried to write it. If the user doesn’t match the file it is trying to write then it will simply refuse to perform the action. Even if the permissions are set to 777, this will still not allow you to perform these actions.

The correct way to fix this issue is by opening your httpd.conf which is located here; /Applications/XAMPP/xamppfiles/etc/httpd.conf and simply change the user and group. The user and group might differ so a quick way to find the lines of code we need to edit is to search for User/Group. For us, we had to change lines 173 and 174 from:


User daemon
Group daemon

to


User your_mac_username
Group staff

Once you have made the change, restart XAMPP and this should rectify the problem.

If you are still having issues you can check a couple of other things. Firstly we can verify the ownership by opening Terminal and running the below command:


sudo chown -R your_mac_username:staff /path_to_webroot/www/

Secondly, we can confirm permissions and ensure all directories have 755 and files have 644 (which is the correct access level). To do this we can run the following command in terminal:


find /path/to/your/wordpress/install/ -type d -exec chmod 755 {} \;
find /path/to/your/wordpress/install/ -type f -exec chmod 644 {} \;

And that should be the permission issues solved!

There are other methods to fix this but this is definitely the best one to go for! We’ll show you another way to resolve the issue anyway incase you are interested.

The second method can be fixed by simply adding the following code your functions.php file:


define( 'FS_METHOD', 'direct' );

You may also need to amend the permissions of the directory of your website. To do this we can right-click the folder and click Get Info. Once here, we can change admin and everyone to have Read & Write permissions. We can then click the padlock key and then click the ellipsis icon (circle with three dots) and click ‘Apply to enclosed items…’

This will also rectify the issue although it’s not the preferred method. Also, you will find yourself having to perform the same action for every project so you may as well do it the right way first 😉

Well, we hope we managed to resolve your WordPress permission issues today. Let us know in the comments below if you found this useful.

If you need help setting up VirtualHosts in XAMPP on Mac you can take a read of this blog.

View Source
Posted in WordPress