Tutorial

Migrating a ProcessWire Website to an Ubuntu VPS

Published on March 20, 2014
Migrating a ProcessWire Website to an Ubuntu VPS

Status: Deprecated

This article covers a version of Ubuntu that is no longer supported. If you are currently operate a server running Ubuntu 12.04, we highly recommend upgrading or migrating to a supported version of Ubuntu:

Reason: Ubuntu 12.04 reached end of life (EOL) on April 28, 2017 and no longer receives security patches or updates. This guide is no longer maintained.

See Instead: This guide might still be useful as a reference, but may not work on other Ubuntu releases. If available, we strongly recommend using a guide written for the version of Ubuntu you are using. You can use the search functionality at the top of the page to find a more recent version.

Introduction

ProcessWire is a flexible, open-source PHP Content Management System. It is easy to update for clients and a pleasure to work with for developers.

System requirements

You will need a standard LAMP stack to run ProcessWire. When creating your droplet, under Applications, choose LAMP on Ubuntu. A full list of requirements is available here.

Enable htaccess

To use mod_rewrite, htaccess overrides have to be enabled. You will need to modify the default host configuration file. This can be found at:

/etc/apache2/sites-available/default

Open it in either vim or nano. Look for the following section (it starts with Directory /var/www):

<Directory /var/www/>
  Options Indexes FollowSymLinks MultiViews
  AllowOverride None 
  Order allow,deny
  allow from all
</Directory>

Where it says AllowOverride None change it to AllowOverride All.

Enable GD

ProcessWire requires GD to be installed in order to resize and crop images uploaded through the CMS. To install GD and run it, use the following commands.

apt-get install php5-gd
service apache2 restart

Enable mod_rewrite

ProcessWire requires that the mod_rewrite PHP module be enabled. If you use Digital Ocean’s LAMP Application droplet configuration, it should already be installed and will only need to be enabled. To enable it and restart Apache, run the following commands:

a2enmod rewrite
service apache2 restart

Enable sending email

If you wish to have a contact form on your website, you will also need to ensure that sendmail is installed and configured so that you can use features that send email.

apt-get install sendmail
sendmailconfig
service sendmail restart
service apache2 restart

To speed up PHP mail, add the following line to your host file, which can be found at /etc/hosts, replacing yourhostnamehere with your host name.

127.0.0.1 localhost localhost.localdomain yourhostnamehere

Check that all modules were installed correctly

Visit your site URL’s PHP Info page to see that all modules have been installed correctly at http://yourhostname/info.php where you replace yourhostname with your actual host name.

  • GD

  • sendmail

  • mod_rewrite

Once those are there, we are ready to download and install ProcessWire.

Compress the files of your site

Create a compressed archive of your website for faster upload.

Be sure to include a MySQL dump for your website as well.

Don’t forget about your .htaccess file, which is invisible by default. This file is required.

tar cvf site_name.tar directory/

Uploading your ProcessWire website

Log in to your website by typing the following command in the command prompt:

ssh user@yourdomain

Go to your public web directory:

cd /var/www

Upload the archive of your website to your droplet using secure copy.

Make sure to also upload a copy of your MySQL dump file.

Unarchive your website

Once your website has uploaded, you can extract your website using the following command:

tar xvf website.tar 

This may unarchive your website into a folder called website/. If this is the case, you will need to move all of the contained files back one directory to /var/www. This can be done with the following commands:

cd website
mv * ..

MySQL import

Create a database

Assuming you already have a MySQL username and password created, you will need to login to MySQL and create a database:

mysql -u username -ppassword

Upon successful login, you should see mysql >. Run the following command to create a new database:

create database dbname;

To verify that a database has been properly created, you can run the following command:

show databases;

Import your MySQL dump

Now that you have a database, you can import your MySQL dump file to it using the following command:

mysql -u username -ppassword dbname < path/to/mysqldump.sql

Update config.php

Now that you have uploaded your database, you will need to update your site/config.php file with your new database credentials:

$config->dbHost = 'localhost';
$config->dbName = 'dbname';
$config->dbUser = 'username';
$config->dbPass = 'password';
$config->dbPort = '3306';

Finishing up

Go check out your website. To make sure everything is working properly, visit some of your pages and login to the dashboard.

If you are unable to successfully login, it may be because the /site/assets/sessions directory doesn’t exist or is not writeable.

You will need to ensure that the /site/assets folder is writable by the server so that you can upload files and login.

Also be sure to delete your MySQL dump file once your website is working properly.

Further reading

If you have any questions about ProcessWire, you can try the forums.

<div class=“author”>Submitted by: <a href=“http://tinaciousdesign.com”>Tina Holly</a></div>

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the authors

Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
 
Leave a comment


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Join the Tech Talk
Success! Thank you! Please check your email for further details.

Please complete your information!

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.