Sometimes websites produce warnings or error messages without giving any clues what caused the issue. Surely this has happened to everyone and it is annoying, especially if it happens at a website you are supposed to maintain. 

Recently someone reported that they are unable to update articles because every time they try they get the message "Warning, Registration failed. Please try again."  Clearly this message does not belong anywhere near the editing process where articles are updated or created. Something must have gone wrong in a third party extension or a home grown plugin.

If you have a similar situation where a seemingly unrelated error or a warning is reported in the browser, search for the text string from the website or clone or simply download the filesystem of the site and search on your workstation. A utility like grep or Windows grep are the easiest to use.

The text of the message is most likely to be found in one of the language files.  This of course assumes that the extension that produced the message follows Joomla best practice of keeping the message texts in separate files, consisting of language constants and language strings.

Language Files

Third party extensions add their own language files into the languages folder either at the front end or the back end of the site, or both.  Extensions can also install their language files in a subfolder in the same folder where the extension itself is installed. Therefore a text search utility is the best approach to find any obscure messages where the origin can be anywhere in the system.

Language File Example

Once you find a match in a language file, copy the language constant from the start of the line and then search for that constant from the website filesystem or its copy exactly the same way, using a utility like grep or Windows grep. This way you can identify the file or all the files where the language constant has been used and you will be able to identify the extention.

If the message is not defined in one of the language files, it would have had to be hard coded in a third party extension, for example a plugin, which you may then be able to unpublish.

 

It was time to take inventory of third party extensions and remove those that were not needed on a test site.  Found only a couple of extensions and the Akeeba Release System (ARS) was one of them.  This was going to be easy! Clicked the Uninstall button, only to see a nasty PHP fatal error displayed on a blank page about a missing file in a library.  The site was rendered unusable.  How come?

A closer look at the error identified that the Admin Tools extension was trying to load the fof30 library.  Interesting, one extension by Akeeba disabled the other!  The manifest file of ARS revealed that the uninstallation of the package is done by the script  /administrator/manifests/packages/ars/script.ars.php

The uninstall() function has two lines of comments about the uninstallation of the FOF library possibly failing if other extensions are dependent on it.  Instead, the relatively old version of the uninstallation script of the unsupported extension missed the existence of the latest version of Admin Tools completely and zapped the library.

Solution:  comment out the following line from the uninstall() function before starting to uninstall.

// $this->uninstallFOF($parent);

The moral of this true story:

  • run the uninstall script once on a test site before installing a new extension on a live site
  • avoid unsupported extensions unless you are prepared to troubleshoot

If you have issues with SMTP emails, you can get Joomla to record all the detailed messages exchanged with your SMTP server.  Inspecting the low level transaction log often allows you to see what is going on between the two servers and resolve any connectivity issues with your IT or hosting provider.  This custom method is quite simple to set up if you have FTP or SSH access to the Joomla folder in your web server.

This SMTP debug option involves a temporary modification to a file in the JMail class, an extension of the PHPMailer library. Warning: core modifications are not recommended and you should revert the file back to the original version as soon as possible.

First make a backup copy of the file your are going to modify, libraries/joomla/mail/mail.php.  Then edit this file, mail.php, and add the following lines to the beginning of the function useSMTP(), after line 634:

// 20170221 SMTP log
$this->SMTPDebug = 4; // maximum level data output
// $this->Debugoutput = 'error_log'; // use the PHP error log, as configured in php.ini
$this->Debugoutput = function($message, $level) { $file = 'mail_log.txt'; $config = JFactory::getConfig(); $logfile = $config['log_path'] . '/' . $file;
$log = fopen($logfile, 'a'); fwrite ($log, $message); fclose($log);};
// 20170221 end

After you click the button Send Test Mail in the Global Configuration or any other mail function, you can download the file 'mail_log.txt' from the Joomla log folder, usually administrator/logs.  

Remember to restore the original version of the file mail.php before the log file grows too much.

And here is the way you can log the mail debug entries by using the standard debug option.  Configure the plugin 'System - Debug' with the following key settings:

  • Allowed Groups: Super Users
  • Log Priorities:  All
  • Log Categories: mail
  • Log Almost Everything

Turn on the debug option in Global Configuration and you can find all the details of the SMTP connection requests and responses with error codes from the file administrator/logs/everything.php.

 

 

 

If your Joomla! site has issues in connecting to your SMTP mail server, it is possible to get a detailed log of all the messages exchanged between your Joomla site and the SMTP server.  Inspecting this low level transaction log allows you to see what is going wrong between the two servers and then get your IT department or hosting provider to resolve any connectivity issues. 

Go to Extensions - Plugins and configure the system plugin 'System - Debug' with the following settings:

  • Allowed Groups: Super Users
  • Log Priorities:  All
  • Log Categories: mail
  • Log Almost Everything

 

20180425 system debug plugin 20180425 system debug logging

 

Go to Global Configuration and turn on the debug option in the System tab - Debug Settings - Debug System.  

20180425 debug settings

 

Go to the Server tab - Mail Settings and click the button Send Test Mail. 

20180425 mail settings

 

The test result, success or failure, will then get displayed as a system message, but you can download the detailed log file 'everything.php' from the Joomla log folder, usually administrator/logs, or, if your site was installed much earlier, from the /logs folder in the main Joomla folder.

20180425 everything example

 And this is the email we would like to receive from the website:

20180415 test mail

More about logging from the Joomla! Documentation at https://docs.joomla.org/Using_JLog

Make sure you have Google 2-Step Verification turned on: https://www.google.com/landing/2step/

As explained in this article: https://support.google.com/accounts/answer/185833?hl=en, create an application specific password, "App Password", 'my-app-password' below, for your SMTP connection: https://security.google.com/settings/security/apppasswords

Now you can use the following mail settings:

Mailer SMTP
SMTP Host smtp.gmail.com
SMTP Port 587
SMTP Security STARTTLS
SMTP Authentication Yes
SMTP Username This email address is being protected from spambots. You need JavaScript enabled to view it.
SMTP Password my-app-password

Advertisement

Going hiking?

Camino de Santiago T-shirt
Etsy GlokalCorner Camino de Santiago T-shirt
 
The Viking Way T-shirt
Etsy GlokalCorner The Viking Way T-shirt
Advertisement

T-Shirts Amazon USA

Motivational
Amazon Glokal Corner Power Mom T-shirt
 
POM BFF
Pom Best Friends Forever T-shirt