Keeping software updated can be very time consuming because let’s face it, software runs our lives. Unless you’ve been living in the forest the past 20 years, you use software daily. As a Developer, I use phpMyAdmin, it’s my app of choice when managing databases because it runs smoothly, and it’s free. I love free, don’t you?
Now there comes a time in a Developer’s life when he/she needs to upgrade their phpMyAdmin installation. But since it’s one of those things that isn’t entirely “urgent” for the most part, security updates aside, we tend to put off upgrading until we start to see rust (metaphorically speaking).
Automatic upgrades for phpMyAdmin
I’m going to assume you’re using a Linux/Unix server, and know how to use the command line, since that’s the way I roll. If you don’t have git installed, just type:
sudo apt-get install git-core
Now let’s grab the latest phpMyAdmin code:
git clone --depth=1 --branch=STABLE git://github.com/phpmyadmin/phpmyadmin.git
This says, go into my home/workspace directory, and pull the latest version from git, but not the entire git history.
Next, let’s create a command line script to run the updates. I’m a Florida PHP Developer, so we’ll use PHP. Name the script update_phpmyadmin.php for simplicity.
$cmd = "cd /home/YOUR_USER/workspace/phpmyadmin;git pull -q origin STABLE";
Before being able to use this script, we need to make it executable; type this:
sudo chmod 700 /path/to/update_phpmyadmin.php
Finally, let’s schedule the task with cron so it runs automatically:
# Automatically upgrade phpMyAdmin daily (1:00am)
0 1 * * * * /path/to/update_phpymyadmin.php >/dev/null
There you go, you’re automagically updating your phpMyAdmin install.
Why not use apt-get or yum or brew?
You might be asking why not just use apt-get or yum or brew (MAC) to automatically update phpMyAdmin. The answer is simple. You want the latest from phpMyAdmin, and apt-get/yum tend to fall behind. If you want the latest phpMyAdmin, use this approach.
You just learned how to get phpMyAdmin to auto update. Use with caution; not responsible if you break something. Should you need PHP Developer help, contact us for a quote.
Please confirm your code works locally before pushing to a web server. Please eyeball the code before running it to confirm it will not destroy you system. Not responsible for any damages.