How to fix Unable to Update WordPress to Latest version ( File Permission or Directory issue)

WordPress Websites For Your Internet Marketing Success

Unable to Update WordPress to Latest version ( File Permission or Directory issue) or How to Fix the “Installation Failed: Could Not Create Directory.” Error in WordPress: This error became a headache to me and I tried many solutions, some of them I already know and some of them, I read from StackOverflow, medium.com, and many other websites about the server commands and other things. But I got nothing from the last 3 days. Do you imagine my pain of upgrading WordPress and failed continuously for 3 days?

 

Updating WordPress is just a 20-second task and it takes me 3 days. so, finally, after so much research I got my solution and now I will share it with you.

Diagnosing the “Installation Failed: Could Not Create Directory.” Error in WordPress (2 Methods)

The good news about this error is that it’s relatively easy to fix. Most of the time, correcting your permissions will clear everything right up. Before you start work on that solution, however, you may want to make sure that it can actually solve your problem.

Below, we’ve outlined two methods for determining whether your site is experiencing a permissions-related error.

  1. Use the WordPress Site Health Tool
  2. Check Your Server’s Error Log

 

So let’s discuss why this issue (Unable to Update WordPress) comes?

As I observed the issue very deeply and I found a few main issues are given  below:

  1. WordPress files or directory is missing. You can download WordPress manually and add the missing file or replace the whole directory.
  2. WordPress files or directory permission should not be as per guidelines. you can download WP Security Plugin and go to the file system security page to check files and directory permissions.

    WP security plugin to fix files permission in wordpress
    WP security plugin to fix files permission in WordPress

  3. if you tried both methods given above then definitely you are using Dedicated Linux Server (Redhat, Centos, or any other). So in this case you need to update your directory user and its group. sudo chown -R apache:apache /path/to/WordPress.

 

This command will help you. for Linux servers, you can use this command as given below.

sudo chown -R apache:apache /var/www/html/WordPress

Here, the WordPress means your directory if your WordPress is in the main directory then remove the “WordPress” word from the end. this will update your user and group from root to apache. after this command, you can check file and directory status by ls -l  command.

after this command now you can try again to update WordPress from your admin panel. if you again failed that means you have an issue as I had.

Errors on your WordPress site can slow down your work and create serious inconveniences for both you and your users. For instance, the “Installation failed: Could not create directory” message can prevent you from providing a key feature or functionality.

Now Please follow my steps very carefully and I am expecting that you tried all ways given above. So, Here you need to only 2 last commands for this problem.

The final way to solve this issue “Unable to Update WordPress”:

Let’s get started! just enter the command given below to check your files. It’s again the “Ls” (Listing) command.

ls -Z /var/www/html/path_to_your_website_folder/

After this command, you will get the result given below. if you saw the same something is this. that means your user and group is apache: apache.

Unable to Update WordPress to Latest version
Command Result in Terminal

 

Now step 2  is run the command again given below:

chcon -R --type httpd_sys_rw_content_t /var/www/html/rr/path_to_your_website_folder/
Unable to Update WordPress to Latest version
Command results in Terminal

So, After this command, your WordPress will upgrade to the latest version. I hope my blog will be helpful to you. Please share this on social media so it will rank high for others. You can also read about, How to earn money with any investment. and Top freelancing languages.

 

Summary for Unable to update WordPress to the latest version.

Here, sometimes Linux terminals without full knowledge will be tough for any developer. So, I recommend getting some knowledge about Linux basic commands in your free time. WordPress has many security loops and I personally recommend you to make your WordPress website secure with security plugins like Wordfenece or WP security.

 679 total views,  9 views today

Leave a reply


This site uses Akismet to reduce spam. Learn how your comment data is processed.