Question

How to update WordPress?

Posted October 25, 2013 18k views
I isntalled WordPress in my VPS, now WordPress released a new version, I want to update it, how I should to do? When I click the WordPress update url, it need enter FTP username and password, but my VPS does not seem to install FTP.
1 comment
  • I am not sure of the root I took to get wordpress but I can say that I have two combinations for group and user

    -rw-r--r--  1 www-data www-data   486 May 16 20:51 error_log
    -rw-r--r--  1 www-data www-data   393 May 16 20:51 htaccess.txt
    -rw-r--r--  1      501 staff      418 Sep 25  2013 index.php
    -rw-r--r--  1      501 staff    19935 Jan  2 18:51 license.txt
    -rw-r--r--  1      501 staff     7433 May 10 09:04 readme.html
    drwxr-xr-x  7      501 staff     4096 May 11 10:16 wp-content
    

    I seem to remember setting these and you say they should belong to ubuntu which is
    www-data www-data
    instead of wordpress as itself

    501 staff

    I am probably getting mixed up somewhere so would appreciate learning how so and to manually do what is needed. Thanks for insight.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
15 answers
If you're using Ubuntu, the relevant command is sudo chown -R www-data:www-data /path/to/WordPress_directory
@Andrew SB, thanks for a great response, this process scares the crap out of me and I don't want to mess it up.

In the tutorial at,
https://www.digitalocean.com/community/articles/how-to-install-wordpress-on-ubuntu-12-04

it instructs me to do this,

"We are almost done uploading Wordpress to the virtual private server. The final move that remains is to transfer the unzipped WordPress files to the website's root directory.

sudo rsync -avP ~/wordpress/ /var/www/

Finally we need to set the permissions on the installation. First, switch in to the web directory:

cd /var/www/ "

...Have I missed something? Did it not actually move the WP install to that directory in the install process like I thought?

Looking through all the files in SFTP I see, root/wordpress/ is that what ~/wordpress/ is referring to?

I just want to be sure I am changing permissions to the right directory. I found someone else with the same issue here,
https://www.digitalocean.com/community/questions/how-do-i-enable-wordpress-to-update-itself-through-its-back-end
and in this someone suggested to use,

sudo chown -R www-data:www-data /var/www

This seems like the one I should use, is that correct?

I also pasted my output from,
ls -la /var/www
and got this,

http://pastie.org/9144678#1
by Etel Sverdlov
Wordpress is a free and open source website and blogging tool that uses php and MySQL. It was created in 2003 and has since then expanded to manage 22% of all the new websites created and has over 20,000 plugins to customize its functionality. This tutorial shows how to install Wordpress on a server with LAMP. It is written for Ubuntu 12.04.
@shanelharder:

You are absolutely right. I only skimmed the tutorial to try and see what you did. The Wordpress folder should be in /var/www and the paste you post does indeed confirm that it is. Very sorry! So yes,


sudo chown -R www-data:www-data /var/www


is correct.

As for being scared of the process, one of the great things about being able to take snapshots of your droplet and spin up temporary ones for pennies is that you can just test it out on a throw-away droplet with out worries. And always make a backup! =)

If anyone else is on Ubuntu 16.04 use sudo chown -R www-data:www-data /var/www. Updates work for me now

Try forcing it to use filesystem:
define( 'FS_METHOD', 'direct' ); in the wp-config.php file.

Also, chown the directory to the apache's username and group so it won't have permissions issues:
chown -R apache.apache public_html
Yeah its permissions issue. Change the ownership of the WordPress directory and all contents to the web server user as described above and you'll be able to update from within WordPress and add / updates plugins too.
  • If you have multiple sites and the server owns permissions then isn’t this bad. I thought we should have each website own the rights to modify only its own files and folders…I thought this is why we created a wordpress group..for example if a hacker gets a script in one website then the script is able to act across the other sites? This may be entirely wrong but I am not seeing a clear answer online for this. So thank you for insight or answers.

Thanks a million!
According to your approach, I successfully solved the issue. thanks again!
Thanks, it works for me. I can upgrade directly from WP menu

Btw, could you elaborate this command? sudo chown -R www-data:www-data /path/to/WordPress_directory
I'll give it a spin -

"sudo" - executes the command as the root user on the server

"chown" - "change owner"

"-R" - recursive, drilling down to all child directories and files of the nominated file

"www-data:www-data" - specify the user and group to change the owner to - on Ubuntu, www-data is the name of the user that runs the web server process

"/path/to/Wordpress_directory" - simply the file path to the wordpress installation.

On the prebuilt DigitalOcean boxes, the file path will be something like /home/wordpress/public_html
Beauty! This solved my problem! Great explanation!
This is great solved my issue as well. Thanks for the help!
This sounds like a great solution. However, I am having a hard time finding the public.html file,
I followed this tutorial to install wordpress,
https://www.digitalocean.com/community/articles/how-to-install-wordpress-on-ubuntu-12-04
the root directory for wordpress is in var/www but i don't see public.html anywhere. What am I missing?
by Etel Sverdlov
Wordpress is a free and open source website and blogging tool that uses php and MySQL. It was created in 2003 and has since then expanded to manage 22% of all the new websites created and has over 20,000 plugins to customize its functionality. This tutorial shows how to install Wordpress on a server with LAMP. It is written for Ubuntu 12.04.
@shanelharder: If you followed that tutorial, then your Wordpress folder should be in "~/wordpress/" so you'd run:


sudo chown -R www-data:www-data ~/wordpress/
Cool, worked like a charm, I can now quickly and easily update wordpress from within my WP dashboard with the automatic update option.

Great tip on the droplet snapshot! Not sure why I didn't think of that but I did that as well just to be safe and that process was pretty easy as well.

Hi all,

You can also update the WordPress core using WP-CLI from your command line. WP-CLI is useful for managing your website and one of the options you can use is to update the WordPress version for your site.

We have an existing tutorial on how to use WP-CLI to manage your WordPress site which you can check here:

https://www.digitalocean.com/community/tutorials/how-to-use-wp-cli-to-manage-your-wordpress-site-from-the-command-line

Run the following command to check if there is an available update for WordPress.

wp core check-update

If there is an available update you will get the information about the update like version, updatetype and packageurl or else, the output will indicate that no update is available.

Run the following command to update WordPress:

wp core update

You will get the following output if the update completed successfully:

Success: WordPress updated successfully.

Hope that this helps!
Regards,
Alex

by Justin Ellingwood
WordPress is a popular CMS and blogging software that can be used to quickly deploy sites. In this guide, we will demonstrate how to control your WordPress installation from the command line using a tool called wp-cli.
Submit an Answer