This tip is about upgrading your OpenX 2.4 installation, with emphasis on making the upgrade easy, risk-free and quick. By upgrading I mean going from version 2.4.x to 2.4.y or from 2.6.x to 2.6.y (I call this a minor upgrade). But it applies to upgrading from version 2.4 to 2.6 as well. The most important tip I can give is: make backups!
I’m starting with the assumption that you’ve installed your OpenX system on your website example.com in a folder called ‘openx’ (so the address is www.example.com/openx/), and that it has been installed and configured correctly.
Upgrading is essentially a four step process:
- Upload program files for new version in a separate folder
- Copy configuration file, copy banner images and set folder permissions
- Backup the database
- Rename folders and run the upgrade procedure
I’ll discuss these steps in more detail in the remainder of this article.
1. Upload program files
My strategy for an upgrade is to start by creating a new folder at the same level as the existing ‘openx’ folder. I always call this folder ‘openx_new’. Then I use my FTP program to upload the files of the new version into the new folder. I always unpack the zip file I download from OpenX.org on my own computer first and then I upload the resulting file set.
2. Copy configuration file, banner images and set folder permissions
The OpenX configuration file can be found in the ‘var’ folder just below the ‘openx’ folder. The name of the starts with your domain name and ends in ‘conf.php’. Download it to your local computer using your FTP program and then upload it into the ‘var’ folder just below the ‘openx_new’ folder.
When you’ve setup your OpenX to allow for storage of banner image on the local webserver, the image files can usually be found in the ‘www/images’ folder just below your ‘openx’ folder. Download these to your local computer in a new directory, and then upload them in to the ‘www/images’ folder just below the ‘openx_new’ folder.
Finally, you will have to change permissions on a few folders and files. Many FTP programs can do that in just a few clicks. I use SmartFTP (still using version 2.5 after discovering a few annoying bugs in version 3). If your server is running on Linux or Unix, the permissions of the ‘var’ folder in ‘openx_new’ and all files and folders in it have to be set to ‘777′. The permissions of the ‘www/images’ folder in the ‘openx_new’ also have to be set to ‘777′.
3. Backup the database
At this point all you have done is preparation. Do make sure nobody else is busy working in OpenX, adding any inventory for instance. Now make a full backup of the database that stores your OpenX information, and also check the resulting backup file to make sure it’s complete.
OpenX databases tend to become rather large over time. So in addition to making a backup, you should also think about a way of restoring that backup. A nice little tool to restore a very large database backup is called ‘big dump‘ (a free download). It comes with some instructions.
The OpenX upgrade wizard normally creates backup versions of all the tables in your OpenX database that are changed during the upgrade. These backup tables are used to attempt a recovery when the upgrade goes wrong in any way. But since you already have a full database backup, there is a little trick to make the next step work a little bit faster and with less overhead by not creating these backup tables. The trick is to put a file named “NOBACKUPS” in the ‘var’ folder just below your ‘openx_new’ folder. The file can be completely empty, it’s just the name and the fact that it’s there that tell the upgrader to skip creating backup tables. It does mean though that when something does go wrong during the upgrade (unlikely but still possible) you’ll have restore everything manually (that’s why I do a full database backup manually just before upgrading).
4. Rename folders and run the upgrade process
The last step of the upgrade procedure is to trigger the upgrader, as follows:
- Rename your existing ‘openx’ folder to ‘openx_old’
- Rename your new ‘openx_new’ folder to ‘openx’
At this point, the new version is already serving your ads. Or at least it will try to. In the case of an upgrade from version 2.4 to version 2.6, the database changes are extensive and your ad server will most likely not deliver ads until you’ve gone through the full upgrade wizard.
All you have left to do is complete the upgrade, like so:
- Access the OpenX administrative interface in your web browser by going to the http://www.example.com/openx/ web address. The software will recognize that an upgrade is in progress and instead of presenting the usual login screen it will start the upgrader. This upgrader is a wizard that does the necessary work for you. At some point you will have to prove you’re allowed to do that upgrade by entering your administrator user name and password.
Usually, this final step takes very little time, only a few minutes if you read all instructions and information carefully. On a very large database it may take longer.
When you’re having problems during the upgrade but haven’t gone through the database upgrade yet (one of the last steps and the one that’s most likely to cause problems) you’ll be able to quickly go back to the old version is to rename the two folders again (‘openx’ to ‘openx_new’ and then ‘openx_old’ to ‘openx’). Then correct whatever problem there was and go back to the beginning of step 4. If something goes wrong during the database upgrade, you’ll have no choice but to restore the database backup you created in step 3 and rename the two folders again in the way I described above.
If you follow these steps, I’m confident the upgrade will be smooth and quick, and you’ll be prepared to handle anything that might still go wrong during the upgrade.
Have you read this tip but still feel uncomfortable about upgrading OpenX on your own? Why don’t you ask me to do it for you? If you’re interested, just contact me for more information.
Disclaimer:
- This tip was written for an upgrade of OpenX 2.4.x to 2.4.y., 2.6.x to 2.6.y, or from 2.4 to 2.6.
- An upgrade from OpenX 2.0 to 2.4 is almost identical but there are essential things that are different.
- This tip does not cover the upgrade procedure for setups with multiple ad servers.