This post has info on manually restoring a Joomla 4.3.4 set-up across two servers. While both are Linux systems the configuration differ slightly including the OS, Php , DB, etc. Various issues were faced & overcome in doing the restoration.
Background info:
- Source:
Ubuntu 22.04, Php 8.2, Joomla 4.3.4, Apache, Maria DB, Addon Plugins (AddToAny, LazyDb, Komento, SexyPolling)
- Destination:
Ubuntu 20.04, Php 7.4, Joomla 4.3.4, Apache, MySql 8.0
- Latest DB dump & htdocs folder (including all files, modules, plugins, media, images etc.) from Source was transferred to Destination server via Ftp before hand.
Steps:
1) DB Import
1.1) Create user, db, grant all permission to user.
1.2) Import data to the created db from the latest DB dump of the source.
1.2.1) ERROR 1366 (HY000) at line 2273: Incorrect integer value: '' for column 'checked_out' at row 1. Solution is to set NO_ENGINE_SUBSTITUTION & then import:
SET @@GLOBAL.sql_mode= 'NO_ENGINE_SUBSTITUTION';
1.3) ERROR 1101 (42000) at line 10692: BLOB, TEXT, GEOMETRY or JSON column 'country' can't have a default value
- Using the solution found online & the DB dump sql import script was changed to set DEFAULT values for the problematic text columns country, city, etc
// Modify the sexypolling plugin CREATE TABLE script:
CREATE TABLE `#_sexy_votes` (
`id_vote` int(10) unsigned NOT NULL AUTO_INCREMENT,
....
`country` text NOT NULL DEFAULT (_utf8mb4'Unknown'),
`city` text NOT NULL DEFAULT (_utf8mb4'Unknown'),
`region` text NOT NULL DEFAULT (_utf8mb4'Unknown'),
`countrycode` text NOT NULL DEFAULT (_utf8mb4'Unknown'),
PRIMARY KEY (`id_vote`),
.....
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
2) Download Joomla_4.3.4-Stable-Full_Package.zip from joomla.org
2.1) Unzip Joomla_4.3.4-Stable-Full_Package.zip to /var/www/html & rename folder to <site_name>
2.2) Set up site configuration.php (/var/www/html/<site_name>/configuration.php)
- Add db, username, password
- Add tmp_path & log_path in
public $log_path = '/var/www/html/<site_name>/administrator/logs';
public $tmp_path = '/var/www/html/<site_name>/tmp';
3) Restore Joomla modules, plugins, languages, etc from file system Ftp backup location of Source.
4) Additional system settings on Destination
4.1) Add missing Php modules: "Call to undefined function" error
4.1.1) simplexml_load_file()
sudo apt-get install php7.4-xml
4.1.2) "IntlTimeZone" module missing
sudo apt-get install php7.4-intl
4.2) Increase Php upload limit (/etc/php/7.4/apache2/php.ini)
post_max_size = 38M
upload_max_filesize = 32M
4.3) Restart apache
sudo systemctl reload apache2
5) Recovering from J4 Red Error Page of death
5.1) Redirection to installation/index.php:
- With an error "500 - Whoops, looks like something went wrong".
- Needed to delete the installation folder, to stop the redirection.
5.2) Next, 404 Component not found error on the home page:
---
404 **Component not found.**
Call stack
# Function Location
1 () JROOT/libraries/src/Component/ComponentHelper.php:296
2 Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT/libraries/src/Application/SiteApplication.php:210
3 Joomla\CMS\Application\SiteApplication->dispatch() JROOT/libraries/src/Application/SiteApplication.php:251
4 Joomla\CMS\Application\SiteApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:293
5 Joomla\CMS\Application\CMSApplication->execute() JROOT/includes/app.php:61
6 require_once() JROOT/index.php:32
---
5.3) Checked DB connections using a custom php script:
No issues connecting to DB with username/ password!
5.4) Enable Debugging/ Logging:
5.4.1) Logging in php.ini (/etc/php/7.4/apache2/php.ini)
----Turn on logging-----
display_errors = On
html_errors = On
display_startup_errors = On
log_errors = On
error_log = /var/log/apache2/php_errors.log
5.4.2) Logging in configuration.php (/var/www/html/<site_name>/configuration.php)
// Change to true from false
public $debug = true;
public $debug_lang = true;
// Change to 'maximum' from 'default'
public $error_reporting = 'maximum';
// Change to 1 from 0
public $log_everything = 1;
With those J! Info started showing up in the browser along with the error stack trace & queries.
5.5) Root cause analysis
5.5.1) Checked the specific php libraries:
libraries/src/Component/ComponentHelper.php:296
libraries/src/Application/SiteApplication.php:210, etc..
- Using var_dump($component), on SiteApplication.php:210 found:
$component = NULL
- The same '$component = "com_content"' on the home page of a default Joomla application (unzip Joomla 4.3.4 zip & install & check value on Joomla home page).
- Test with hard coded $component = "com_content" in libraries/src/Application/SiteApplication.php:210
if(empty($component)){
$component = "com_content";
}
- With this 404 was gone & a broken site home page came up with a few Category links listed out
- Clicking on Category link was showing that "No Article linked to Category", despite there being several Articles imported from source db dump.
5.5.2) Localizing issue with Content/ Article loading:
- Hit the direct Article url:
http://<site_name>/index.php?option=com_content&view=article&id=<article_id>
- This gave another error"404 Article not found", though the specific <article_id> was present in the database.
- J! Info provided the corresponding php file and db query used to fetch article by id which was giving no result
5.5.3) Issue with imports of all "datetime DEFAULT NULL" fields
- On exploring the query further, it was seen to have checks for publish_up & publish_down dates. These needed to be either NULL or set to a date earlier (/later) than date NOW for publish_up (/publish_down).
- In the "#_content" table publish_up & publish_down dates values were showing as "0000-00-00 00:00:00" (i.e. were imported as 0) in place of NULL.
This was causing all records being filtered out.
- It also meant that wherever the "datetime default NULL" fields were imported the same issue was happening.
- A check revealed 30 other J! tables with the same issue.
- Prepared a script to update each of these datetime fields to NULL in the 30 tables.
UPDATE `#_content` SET `checked_out_time` = NULL, `publish_up` = NULL, `publish_down` = NULL;
UPDATE `#_categories` SET `checked_out_time` = NULL;
.... for all the affected tables!
With that the issue was resolved & site home page became functional!