Setting up AMP for JoomlaPack restore
February 20, 2008 by DragosJoomlaPack is really easy to use for backup and restore of any Joomla! CMS content and framework. But what happens when the reinstall and restore from the scratch does not work without any problems?
The article focuses on a AMP stack (Apache, MySQL, PHP) fresh install and configuration — usually a different version of current production stack, and a Joomla! backup restore — created with JoomlaPack. The situation is most frequent in moving the production server to a new service provider (and hoping for almost the same version of the AMP stack) or copying the Joomla framework to a new development machine (where the use of old/deprecated software version is not recommended).
AMP Installation
Downloading and installing the AMP components must be an easy job. Just visit download sections of http.apache.org, www.php.net and www.mysql.com to get the latest stable releases. After installation, check configuration files and make sure that apache+php and mysql services start without problems. For a quick check you can run the famous info.php script (which contains only <?php phpinfo(); ?>) to verify that php is loaded as module and mysql support works fine. If you prefer some of preconfigured servers on the market check the distribution documentation for information about configuration files locations.
After your AMP server is up and running you need to configure each of the stack component to suit Joomla!’s (and extension) needs.
Apache configuration
You’ll start with apache main configuration file (httpd.conf - located in apache/config/ directory). Do a quick check on the configuration directives to ensure that everything is fine in there. If your production site is using Joomla! build-in SEO functionality you might be tempted to activate the Rewrite engine — save that as a final step on restore. Last thing to verify in the apache configuration file is the PHPIniDir directive for instruction about PHP distribution location.
PHP configuration
The php.ini file (in most recent versions) is located in your PHP installation directory or the location can be specified using PHPIniDir directive in httpd.conf. If you have trouble finding it check the output of info.php script for information about the .ini search location. In case that the file does not exist create one by copying php.ini-recommended (found in the PHP install directory) to php.ini and moving it to the searched locations.
In the php.ini file check the following options, to ensure that you have a portable but secure PHP setup, for optimal Joomla! installation or restore:
- display_errors = On|Off — Off for production sites, On - for development machines;
- magic_quotes_gpc = On — decreasing performance, but increasing security;
- short_open_tag = Off — for portability reasons. Enabling this options is surely to cause problems with some Joomla components and modules.
- session.save_path = “/session/save/path” — to specify the folder for saved sessions (optional, and folder must exist on startup).
MySQL configuration
MySQL configuration is specified in the my.ini file located in the MySQL installation directory. Some preconfigured option files can be found there too, and you can use them to configure your server for your data storage needs.
Set the following options, forcing portable (non strict mode) for queries, to fit your Joomla! database backup:
- default-character-set=utf8 — to reflect a complete and flexible character set;
- default-storage-engine=INNODB - set the default storage engine to InnoDB;
- sql-mode=”…” — comment this line (add a “#” in front of the line) to disable SQL strict mode. Enabling strict SQL mode may end in non importable JoomlaPack database text dumps.
Next, if the installation is local and you don’t have a MySQL services provider, you need to setup the database and mysql user in order to permit Joomla to access our database. For this, you can use any available tool to create database and permit access (phpMyAdmin) or login on mysql console as root (by running mysql -h localhost -u root -p) and create database and user with the following commands:
mysql > CREATE DATABASE mydatabase;
mysql > GRANT ALL PRIVILEGES ON mydatabase.* TO ‘myuser’@'localhost’ IDENTIFIED BY ‘mypassword’;
mysql > FLUSH PRIVILEGES;
Joomla restore
To obtain the JoomlaPack backup check our How to backup using JoomlaPack article. After getting the archive, extract the content to your desired directory in the Apache document root (ie: www/joomla). Browse to http://localhost/joomla/installation if the restore is on local machine or http://www.serviceprovider.com/joomla/installation to get to the installation wizard. Follow the installation steps and provide the information needed, including the database, mysql user and password. If everything worked without error then follow the last steps by removing or renaming the Joomla! installation directory and start browsing or administer your site.
If your installation fails, one of common pitfalls at the restore is the SQL text file used by installer to import data into database located in the joomla/installation/sql/joomla.sql. For a production site that is online for a long time, this file can have a large size and also not completely importable by Joomla installer. Disabling SQL strict mode should help here, but if the import still fails try separate into files the block of lines that get the installer and mysql engine stuck. When you will get your data imported into MySQL you should be able to navigate or use CMS to administrate the site. Another common pitfall is not setting short_open_tag = Off in the php.ini file that make some of the components and modules unavailable due to uninterpretable PHP scripts.

You must be logged in to post a comment.