Joomla Updates, Upgrades and Extensions ... Oh My!

A little background to the issue

television icon 64x64pdf icon 64x64Every time I begin a new tutorial, I am in the habit of checking for, and doing updates to the Ubuntu 16.04 machine I am working on. This is easily done with the following commands in a terminal. (The terminal can be opened with [CTRL][ALT][T] from the keyboard or from the Unity Dash.)

sudo apt update
sudo apt upgrade

Well, after doing the updates, I logged into the back end of my Joomla development install and got the ugly error messages you see below:

012 001 Joomla

Well, I thought I did see something about a PHP update while I was doing the Ubuntu updates, but how do I fix this? If you are versed with PHP and programming I am sure that you could fix this in a short order. However, if you are new and using this as a platform to learn, you may be lost as a ball in the tall weeds. Well it turns out that it is fairly simple to fix, so let’s work through this and then talk about an extension that, in my humble opinion, will make developing a tad better.

In looking at the errors above, we see that they are notice errors. A notice error according to the PHP manual is defined as follows. “Run-time notices. Indicate that the script encountered something that could indicate an error, but could also happen in the normal course of running a script.” What this means is that your application should still run but what your doing either looks like an error or may be okay. That sounds a little circular to me. Regardless of the exact meaning of the error, it prevents us from accessing the administrator application of Joomla and we need to fix it.

We can remove the notice errors from being reported by turning them off in the php.ini file. Remember when we set up the LAMP server way back in Episode 1? While we were doing that we turned on the error warnings for all errors by using E_ALL for the error_reporting variable in the file. To turn off the notice warnings, first open a terminal by pressing the [CTRL][ALT][T] keys and then enter the command sudo nano /etc/php/7.0/apache2/php.ini to open the file for editing. With the file open press [CTRL][W] to do a search on the file. In the search box type error_reporting = and press the enter key. This should take you to the line that reads the following:

error_reporting = E_ALL

This is the line that turns on the level of error reporting that PHP will use. So right now, it will report all errors to you no matter how minor. Change the line to read like the following:

error_reporting = E_ALL & ~E_NOTICE

This change will tell PHP to report all errors except for notice errors. In case it is hard to read, that is a tilde character (~) in front of the E_NOTICE. Doing this should let us use the back end of Joomla. Save the file by pressing [CTRL][X] to exit, then press [Y] to save the modified buffer, then press the enter key to write the buffer to the php.ini file. That is all that we need to change in the php.ini file, but for the changes to take effect, we will need to restart the apache server. You will do that by typing the following line in the terminal.

sudo service apache2 restart

Now to test our changes, open your browser and navigate to Joomla’s Administrator application by going to http://joom.dev/administrator. Log in and things should look normal again. See the screen shot below.

012 002 Joomla

That has taken care of the problem of getting into the administrator application of Joomla, but unfortunately, we are no longer getting the notice errors reported to us, and really, we probably do want them. So what to do?

Notice that in the screen shot above, there is an update to Joomla. Recall that when we started this adventure that we installed Joomla 3.5.1 and now Joomla 3.6.0 is available.

Upgrading Joomla

The changes in php 7 are causing the notice error to show up for some of the core modules in Joomla. Fortunately, Joomla fixed these in the 3.6.0 release. Upgrading Joomla to this release is easy, just click the Update Now button at the top of the screen in the Joomla back end. After clicking this button you will be presented with the screen below.

012 003 Joomla

From here click the Install the Update button and Joomla will update itself to version 3.6.0. When it is complete you will get a notification that the site has been successfully updated. See the screen shot below.

012 004 Joomla

By upgrading Joomla to the newest version we get any bug fixes, security enhancements and new features that Joomla has to offer. You should always try to stay up to date with your software, especially if your site faces the outside world.

With Joomla updated we can now turn the error level back up to maximum in php. In the terminal type the following command to open the php.ini file for editing:

sudo nano /etc/php/7.0/apache2/php.ini

With the file open for editing, press [CTRL][W] to open the search box. Enter in error_reporting = in the box a press enter. Change the error_reporting variable to read:

error_reporting = E_ALL

With the line changed, press [CTRL][X] to exit, press [Y] to save the buffer and then the enter key to save the file. Now restart apache for the changes to take effect by typing the following command in the terminal.

sudo service apache2 restart

Now that apache has been restarted, go to the back end of Joomla and log in. You should see the normal back end of Joomla with no error messages. Great, our problem is fixed now let’s explore an extension that will make like a little easier for us in the future.

Back It Up Baby

The ability to back up and restore your Joomla site or sites is important for a number of reasons. You can recover from a hacker, recover from a hard disk crash, or even like myself, recover from screwing something up with the Joomla Core files while I was rooting around and mucking with something I should not have been. Regardless, we need an easy way to do a backup and restore for our Joomla CMS software. Fortunately for us, someone has thought about that and created an awesome extension that will do just the thing we want. The extension is called Akeeba Backup and is available for free from https://www.akeebabackup.com. Below is a screen shot at the time of this writing of their home page.

012 005 Akeeba

To get the extension, click the Akeeba Backup for Joomla icon at the top left of the main screen. When you click this you will be taken to the Akeeba Backup page where you can download the extension. See the screen shot below.

012 006 Akeeba

Click the Download Core 5.1.2 button, (Or whatever newer version is being offered), and save the file to your computer. Now we need to install this extension into our Joomla site. Log into the back end of Joomla and go to Extensions | Manage | Install from the menu. Browse to the package you downloaded and select it, then click the Upload and Install button. See the image below.

012 007 Joomla

If you get an error about Maximum PHP file upload size is too small, then we will need to make changes to the php.ini file to fix them. See the image below:

012 008 Joomla

By default, when we installed PHP, the settings for upload_max_filesize was set to 2 megabytes and the extension we are trying to install is larger than this allowed size. Additionally, there is another setting in the php.ini file that can affect us as well. The post_max_size setting determines the largest size of post data that can be accepted. For a default install of PHP this is set to 8 megabytes. This setting, however is large enough for us to upload the extension to Joomla so this one can be left alone. To fix our problem we need to update the php.ini file and make the upload_max_filesize variable large enough to allow us to install the extension.

Open a terminal with [CTRL][ALT][T] and type the following command to open the php.ini file for editing.

sudo nano /etc/php/7.0/apache2/php.ini

With the file open for editing press [CTRL][W] to search and enter upload_max_filesize = in the search box and press the enter key. Change the line to read the following.

upload_max_filesize = 8M

Here we are increasing the size to allow up to an eight megabyte file to be uploaded. This is more than we need and I arbitrarily selected this value to match that of the post_max_size variable in the file. The point is, it needs to be bigger than the file size you plan to upload using PHP.

Now, press [CTRL][X] to exit [Y] to save the buffer and then the enter key to save the file. Remember, whenever we make changes to PHP or Apache, we need to restart the service for them to take effect. Restart apache by entering the following line.

sudo service apache2 restart

With apache restarted, let’s try installing the extension again. This time you should be met with a message that says the install was successful. See the image below.

012 009 Joomla

To use the extension to make a backup, click Components | Akeeba Backup from the menu. If this is the first time you tried to use the extension it will ask you to run the configuration wizard. Click the Configuration Wizard button to get started. See the image below.

012 010 Akeeba Extension

When you click this button, Akeeba Backup will start benchmarking and checking out your site and setup. See the image below.

012 011 Akeeba Extension

When it has finished, you will be presented with a screen that reads Finished Benchmarking and will offer you some buttons to backup, edit the configuration and to schedule automatic backups. This is all we need to get started using Akeeba Backup. Click the blue Backup Now button. See the screen below.

012 012 Akeeba Extension

When you click this button, Akeeba Backup will give you a form where you can add a short description and a comment for the backup. Enter in the information you want and click the Backup Now button. See image below.

012 013 Akeeba Extension

I left the Short description to the default and added a backup comment of “First backup of the Joomla Development Website”. After clicking the Backup Now button you will see a screen of the backup progress. Do not navigate away from this screen until the backup has completed. See the screen shot below.

012 014 Akeeba Extension

When the backup has completed you will be given a screen informing you that the backup has completed successfully. At this point you will want to copy your backup to a safe location. To do so, click the Manage Backups button. See screen below.

012 015 Akeeba Extension

When you click this button for the first time, you will get a notification on how to restore backups. I will cover this in detail in another tutorial, so click the Got It! Button to close the dialog. Finally, you will be presented with a screen listing all the backups you have made. To download the backup click the green Download button. See image below.

012 016 Akeeba Extension

Clicking the download button will issue a warning that downloading through your browser can corrupt the file. Since the server and browser are on the same machine, we will most likely be safe in doing so anyway. Click the download button in the warning dialog. And you will get a second warning. Click the OK button on the second warning dialog to continue. Then the browser should prompt you to save the file. If you have not changed any of the defaults on your browser it should be in your downloads folder. See image below.

012 017 Nautilus

You should see a file with a jpa extension. Save this file in a place that is safe. If you ever need to restore your website, you will need this file and Akeeba Bootstrap to do a restore. I will cover a website restore in another tutorial.

If you feel that it would be safer to directly copy the backup file, you can copy the file from your Joomla install to somewhere safe. If you have not changed the default configuration for Akeeba Backup, you will find your backup files located in the administrator/components/com_akeeba/backup/ folder of your Joomla install. The backup will have a jpa extension and the filename will be made up of site-<site name>-<date>-<time>.jpa. You can copy this file directly to a thumb drive or other safe location without the worry of the browser corrupting it.

Although we went through the effort to do a backup of our website using Akeeba Backup, this does not mean we are in the clear. Having a backup means nothing unless the backup is tested and good. I will cover restoring backups in another tutorial using Akeeba’s other product called Akeeba Kickstart.

Moving Forward

Sometimes as developers, we run into issues along the way. For example, the PHP update in Ubuntu seemed to have broke Joomla because of the error level setting we used in the INI file. It is good to know how to tackle these problems and I hope this tutorial gleaned some light on how you may go about solving these issues. Remember, knowledge is a journey and sometimes we stop off at unexpected places. Thanks you for your support and patronage to my videos and tutorials. If you have any questions please contact me.

END OF TUTORIAL