Content:
To install updates and plugins, WordPress needs write access to your server. There a few issues you could encounter if your server is not configured correctly.
This guide looks at a few of these issues, and how you can solve them.
FTP Credentials Requested
If WordPress is not configured to have direct file system access, it will prompt for FTP credentials when trying to install updates. This could of course be intentional – if you upload files to your server through FTP, simply enter the FTP credentials and the update should proceed.
Enabling direct file system access is an easy process.
In the root directory of your WordPress install, you’ll find a file called wp-config.php
. This file stores various configuration options used by WordPress.
Add the following line to this file:
define( 'FS_METHOD', 'direct' );
Save and exit the file. Reload the page, and you should see the FTP prompt disappear.
File System Permissions
Another common cause of WordPress issues is the lack of correct file system permissions. The system user which runs your WordPress code needs to have write access to install updates.
The user account which runs your code will the same user account which runs your server software. This commonly matches the name of the server software, for example, apache
or nginx
.
You can find the list of available user accounts on your system by running
less /etc/passwd
Set this account as the owner of your WordPress files using the following command. Be sure to run this from your WordPress folder root.
chown user:user . -R
Replace ‘user’ with the name of the account, for example
chown apache:apache . -R
Try running your update again; WordPress should now be able to complete the process.
If you need to access and write to files from another account (for example, your normal user account), you can instead use group permissions. Ensure you set the owner group name to match the group in charge of your web server.
chown user:group . -R
For example
chown qubitsandbytes:apache . -R
You’ll also need to make sure the owner group has write access. Using ls -al
, you can see the permissions given to each file. For example,
rwxr--r--
indicates that the owner (qubitsandbytes
) has rwx
permissions, the group (apache
) has r--
permissions, and other accounts have r--
permssions. In this case, only qubitsandbytes
has write and execute permissions.
To give the group owner (apache
in this example) write access, run
chmod g+w . -R
With the permissions changed, WordPress should now be able to install updates.