If you are experiencing issues with updating WordPress Core or your WordPress plugins/themes, here are some solutions that I have found highly useful to fix the issue.
Why there is no one solution that will fix all the problems related to updates?
There can be a few things that may cause the update issues for plugins or WordPress and each install of WordPress can have its own unique issues.
Essentially, it is either due to the issue with your WordPress install or due to the webserver configuration.
1). Check File and Folder Permissions – 644 and 755 for folders
The first thing that you need to check is the file and folder permissions for your WordPress install and the plugins folder.
By default, the folders should have 755 permission and all the files should have 644 permissions.
Sometimes these permissions can change due to many unknown reasons which lead to update failures.
You will have to access the files and folders using an FTP client like FileZilla or WinSCP.
If you have not done this before, you can follow this detailed guide on the wp-beginner to check the permissions and fix if there is an anomaly.
2). Check file owner
One more thing apart from the file permissions which can cause the update failure for the plugins or the WordPress is the wrong file owner.
Sometimes when we upload files and plugins using SFTP the owners are set to root if you are using the root user.
Make sure that the owner of files is the same as the MySQL user for your WordPress website.
You can check the MySQL user name from the wp-config file.
3). Add Fsdirect in your Wp-config.php
You can add the following line of code to your wp-config.php file in your WordPress install.
So add this line just after define( ‘DB_COLLATE’, ” ); directive in the file.
4). Add script Concatenate as false
Here is the last fix you can also add the following directive in the wp-config.php.
define('CONCATENATE_SCRIPTS', false );
Add the above line of code in the wp-config.php and it may help you solve the issue.
The above mentioned solutions are for fixing wordpress related issues, now let’s have a look at some of the server related issues that we can fix.
5). Restart Apache
Sometimes the server can have issues that also leads to update failures. You can restart the server and see if it resolves the issue.
I recently had a similar issue with my web server and restarting it solved the issue.
If you are using Apache web server and you have root access to the server, you can restart the server
Try the command:
$ sudo service apache2 restart
6). Restart Nginx
If you are using the NGINX web server then you can use the following command to restart the webserver.
7). Restart Memcached
Also, you can restart the Memcached service to ensure that the queries are not cached and at times this will help to solve the issue if you are using Memcached.
8). Restart PHP FPM services
Also, restart the PHP FPM service to ensure that your PHP compiler is working properly.
Here is how to restart the PHP version 7.0 to change the command based on the version of PHP you have.
If you are still not able to solve it than you may require help from a developer or can contact us if you want me to have a look at your WordPress install.
Also, Read How to Clear the NGINX Fast CGI Cache.