(dv) 3.5:Automatic WordPress upgrade with FTP

  • This page was last modified on May 10, 2012, at 10:37.
The (mt) Community Wiki is a collaborative project. Any (mt) Media Temple customer or employee may contribute. Not all articles and/or content have been tested for accuracy by (mt) Media Temple.

For officially moderated and tested articles, be sure to visit our KnowledgeBase.

From (mt) Community Wiki

End of Life Warning

This service has a pending End of Life. Please move to a current service as soon as possible. For more information, please see: (dv) Dedicated-Virtual 4.0: Migration Information.

Contents


Overview

This article will help you configure your WordPress installation on your (dv) Dedicated-Virtual Server 3.5 for easy upgrades.

  • This article is not supported by (mt) Media Temple, as it involves a third-party application (WordPress).
  • The instructions here have not been fully tested. Feel free to perform a test run and then remove this portion of the notice!

Results

You will add your FTP credentials to your wp-config.php file. This will allow you to use the automatic upgrade button from the WordPress control panel.

While it's a great idea and important for security to keep your WordPress installation updated, adding your FTP credentials to your wp-config.php file could leak that information to a hacker, should your site ever become compromised. Adding your FTP information to your wp-config.php file is an increased security risk.

Requirements

Please have your FTP information handy. You can read here for detailed instructions on how to find your information.

Instructions

  1. Locate your wp-config.php file. This file will be at the highest level of your WordPress installation. On your (dv) Dedicated-Virtual Server, this will typically be in the httpdocs folder of your domain.
  2. It's generally a good idea to make a copy of a file before you make changes to it. In this case, you can download a copy with FTP,

    or

    use the copy command in SSH (replace the examples with your own file path):

    
    cp /var/www/vhosts/example.com/httpdocs/wp-config.php /var/www/vhosts/example.com/httpdocs/wp-config.php_orig
    
  3. Now, we will edit the contents of the file. You can either download a copy of the file with FTP and use a plain text editor to modify it,

    or

    you can use vi to edit the file. If you want to use vi, run the following command (replacing the path with your own file path):

    
    vi /var/www/vhosts/example.com/httpdocs/wp-config.php
    

    vi tip: Press "i" to enter "insert mode" so you can type and copy/paste. Use the arrow keys to navigate. Press "Esc" to exit "insert mode" when you are done modifying the file. Type ":wq" to save and quit.

  4. Now we need that FTP information you found in the Requirements section of the article. Here's a general example of what you should add to your file:
    wp-config.php
    
    define('FS_METHOD', 'ftpext');
    define('FTP_BASE', '/var/www/vhosts/example.com/httpdocs/');
    define('FTP_USER', 'username');
    define('FTP_PASS', 'password');
    define('FTP_HOST', 'example.com');
    define('FTP_SSL', false);
    

    What you need to change:

    • /var/www/vhosts/example.com/httpdocs/ - Change to your own server path. If your WordPress installation is the main page for your website, you will likely just have to change example.com to your own domain.
    • username - Your FTP username.
    • password - Your FTP password.
    • example.com - This should be your domain name or IP address - something that resolves to your server.
    • false - OPTIONAL - You may want to change this to true for added security. More details in the next section.
  5. Once you're done adding these lines to your file, save it. Upload the file with your changes to your server with FTP.

You're all set! You should now be able to use the automatic updater feature in WordPress.

Use SFTP for greater security

Secure FTP (SFTP) is safer than plain FTP. To use SFTP for your WordPress updates, you must do the following:

  1. Follow the instructions in this article to enable SFTP: (dv):Enable SSH for FTP user
  2. Switch the FTP_SSL line from false to true, like this:
    wp-config.php
    define('FTP_SSL', true);
    
  3. Save and upload the file, as in Step 5 above.

References

See Digging into WordPress for more discussion of this issue.