WordPress seems to require ftp or ftps access to automatically upgrade itself. This bothered me as I saw it as a potential security risk and work I would have to put in to setting up a FTPS server I didn’t want. My solution was to upgrade WordPress manually.
Following the steps in the link above WordPress was successfully upgraded. The process was not quick and not easy to remember if they are only used periodically. The decision was then easy to build some scripts and directions for upgrading.
The steps need for this process is as follows
- Login into WordPress and disable your plugins.
- Login to your server using ssh.
- Using wget retrieve the latest copy of wordpress. “wget https://downloads.wordpress.org/release/wordpress-4.1.zip”
- unzip the files “unzip wordpress-4.1.zip”
- Backup WordPress on the server
- Upgrade WordPress on the server
- Go to your wordpress wp-admin page.
- You may be prompted to upgrade your databae. Go ahead and do so.
- Enable your plugins.
NOW=$(date +"%Y%m%d") mysqldump -u root -p$1 mysite > ~/mysitebackup/mysite$NOW.sql tar -cvzf ~/mysitebackup/mysite$NOW.tar.gz /var/www/html/mysite
The second file needs to be run in the directory containing the new WordPress application files. These would be the files you retrieved and extracted in steps 3 and 4.
rm -rf /var/www/html/mysite/wp-includes rm -rf /var/www/html/mysite/wp-admin cp -rf wp-includes /var/www/html/mysite cp -rf wp-admin /var/www/html/mysite cp -rf wp-content /var/www/html/mysite chown -R apache /var/www/html/mysite/wp-includes chown -R apache /var/www/html/mysite/wp-admin chown -R apache /var/www/html/mysite/wp-content
I placed these two files in the PATH so that I could run them from wherever. Voila! We now have mostly automated the manual upgrade of WordPress.
Below is a terminal capture of what the process would look like for steps 3 through 6 using the scripts. Steps 4 and 5 will produce verbose output which i didn’t capture below.
Terminal window Steps 3-6
[user@server ~]# wget https://downloads.wordpress.org/release/wordpress-4.1.zip --2015-01-11 17:33:43-- https://downloads.wordpress.org/release/wordpress-4.1.zip Resolving downloads.wordpress.org (downloads.wordpress.org)... 184.108.40.206, 220.127.116.11 Connecting to downloads.wordpress.org (downloads.wordpress.org)|18.104.22.168|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 6718759 (6.4M) [application/zip] Saving to: ‘wordpress-4.1.zip’ 100%[========================================================================================================================================================================================>] 6,718,759 9.46MB/s in 0.7s 2015-01-11 17:33:44 (9.46 MB/s) - ‘wordpress-4.1.zip’ saved [6718759/6718759] [user@server ~]# unzip wordpress-4.1.zip [user@server ~]# cd wordpress [user@server wordpress]# wordpressbackup.sh Enter password: [user@server wordpress]# upgradewordpress.sh