Difference between revisions of "Copying a Joomla website"
From Joomla! Documentation
m (Fix syntax error) |
(Several markup and capitalization changes.) |
||
Line 5: | Line 5: | ||
<translate><!--T:1--> | <translate><!--T:1--> | ||
− | Copying a Joomla! website is a two-part process: you must copy the files and you must copy the database (which is where the content is stored). | + | Copying a Joomla! website is a two-part process: you must copy the files and you must copy the database (which is where the content is stored). Copying the files and copying the database are separate operations. Which you carry out first will depend on your particular circumstances but in most cases it does not really matter. If your website is being updated frequently and you need to take your website offline while the copy takes place, you will probably want to perform the database copy last so as to minimize downtime.</translate> |
<translate> | <translate> | ||
− | ==Copying a | + | ==Copying a Website (Common Method)== <!--T:2--> |
</translate> | </translate> | ||
Line 16: | Line 16: | ||
<translate><!--T:67--> | <translate><!--T:67--> | ||
− | * Akeeba Backup produces a .jpa file</translate> | + | * Akeeba Backup produces a ''.jpa'' file</translate> |
<translate><!--T:68--> | <translate><!--T:68--> | ||
− | * The .jpa file contains all the folders/files and database files.</translate> | + | * The ''.jpa'' file contains all the folders/files and database files.</translate> |
<translate><!--T:69--> | <translate><!--T:69--> | ||
− | * The .jpa file also contains an installer</translate> | + | * The ''.jpa'' file also contains an installer</translate> |
<translate><!--T:70--> | <translate><!--T:70--> | ||
− | * Kickstart.php (from Akeeba) unpacks the .jpa file</translate> | + | * ''Kickstart.php'' (from Akeeba) unpacks the ''.jpa'' file</translate> |
<translate><!--T:71--> | <translate><!--T:71--> | ||
* You then run the installer and install your site like a Joomla install</translate> | * You then run the installer and install your site like a Joomla install</translate> | ||
Line 29: | Line 29: | ||
<translate><!--T:73--> | <translate><!--T:73--> | ||
− | After you create the Database for your Joomla download and install Akeeba, it can be | + | After you create the Database for your Joomla download and install Akeeba, it can be downloaded from the [https://extensions.joomla.org/extensions/extension/access-a-security/site-security/akeeba-backup/ Joomla extension directory]. There is a link to full instructions there as well.</translate> |
<translate> | <translate> | ||
− | ===Copying the | + | ===Copying the Files with FTP=== <!--T:3--> |
</translate> | </translate> | ||
<translate><!--T:4--> | <translate><!--T:4--> | ||
− | One method of copying the files from one Joomla! installation to another is to use standard desktop FTP software to first download all | + | One method of copying the files from one Joomla! installation to another is to use standard desktop FTP software to first download all the files comprising your website from their location on your web server, then upload these files to the location of the new Joomla! installation. Depending on where you're placing the copy of your Joomla! site, the new location could be a different directory on the same web server, or it could be a new location on a completely different web server. When copying a Joomla installation on the same server (i.e. for testing purposes), it is advisable to use a subdomain rather than a subdirectory. This will avoid errors and possible issues in running both installations in unison. </translate> |
<translate><!--T:5--> | <translate><!--T:5--> | ||
− | It is important to maintain the same directory structure for all | + | It is important to maintain the same directory structure for all your folders and files as you move them from one location to another. Fortunately, desktop FTP software will handle this automatically as you upload and download sets of files and folders. (Your FTP software should contain Help documentation that explains FTP and how to use the FTP software interface). |
</translate> | </translate> | ||
<translate><!--T:6--> | <translate><!--T:6--> | ||
− | Note that after you move the files from one location to another, you may still need to edit Joomla! configuration files to get your copy of Joomla! working at the new location; you may also need to change settings for aspects of your | + | Note that after you move the files from one location to another, you may still need to edit Joomla! configuration files to get your copy of Joomla! working at the new location; you may also need to change settings for aspects of your web server to get the copy of your Joomla! site working.</translate> |
<translate><!--T:7--> | <translate><!--T:7--> | ||
− | In rare instances, a file may become corrupted during an FTP transfer, where only part of the file is successfully transmitted. | + | In rare instances, a file may become corrupted during an FTP transfer, where only part of the file is successfully transmitted. If you encounter strange or unexpected errors with your new Joomla! installation after you copy over the files, try re-uploading your files in case of corruption during transfer.</translate> |
<translate> | <translate> | ||
− | ====Download | + | ====Download Files from a Server to Your Computer==== <!--T:8--> |
</translate> | </translate> | ||
Line 53: | Line 53: | ||
# Use FTP software (e.g. FileZilla) to connect to the server</translate> | # Use FTP software (e.g. FileZilla) to connect to the server</translate> | ||
<translate><!--T:10--> | <translate><!--T:10--> | ||
− | # Select the directory you want to download ( | + | # Select the directory you want to download (usually ''/public_html/'' or ''/htdocs/'')</translate> |
<translate><!--T:11--> | <translate><!--T:11--> | ||
# Right click + select files/folder to download, or drag + drop the folder from the "Remote site" view to the "Local site" view</translate> | # Right click + select files/folder to download, or drag + drop the folder from the "Remote site" view to the "Local site" view</translate> | ||
Line 59: | Line 59: | ||
# The downloading of the remote files will start</translate> | # The downloading of the remote files will start</translate> | ||
<translate><!--T:13--> | <translate><!--T:13--> | ||
− | # After you've downloaded the files, check the "Failed transfers" to see if there | + | # After you've downloaded the files, check the "Failed transfers" to see if there were any errors</translate> |
<translate> | <translate> | ||
− | ====Upload | + | ====Upload Files From Your Computer to a Server==== <!--T:14--> |
</translate> | </translate> | ||
<translate><!--T:15--> | <translate><!--T:15--> | ||
− | # Make sure that configuration.php has the right settings for the server (especially: localhost, database, database user, database password, log_path, tmp_path)</translate> | + | # Make sure that ''configuration.php'' has the right settings for the server (especially:''localhost, database, database user, database password, log_path, tmp_path'')</translate> |
<translate><!--T:16--> | <translate><!--T:16--> | ||
# Use FTP software (e.g. FileZilla) to connect to the server</translate> | # Use FTP software (e.g. FileZilla) to connect to the server</translate> | ||
<translate><!--T:17--> | <translate><!--T:17--> | ||
− | # Select the directory you want to upload, and to where ( | + | # Select the directory you want to upload, and to where (usually to ''/public_html/'' or ''/htdocs/'')</translate> |
<translate><!--T:18--> | <translate><!--T:18--> | ||
# Right click + select files/folder to upload, or drag + drop the folder from the "Local site" view to the "Remote site" view</translate> | # Right click + select files/folder to upload, or drag + drop the folder from the "Local site" view to the "Remote site" view</translate> | ||
Line 75: | Line 75: | ||
# The uploading of the local files to the remote server will start</translate> | # The uploading of the local files to the remote server will start</translate> | ||
<translate><!--T:20--> | <translate><!--T:20--> | ||
− | # After you've uploaded the files, check the "Failed transfers" to see if there | + | # After you've uploaded the files, check the "Failed transfers" to see if there were any errors</translate> |
<translate> | <translate> | ||
− | + | ===Copying the Database with phpMyAdmin=== <!--T:21--> | |
− | ===Copying the | ||
</translate> | </translate> | ||
Line 86: | Line 85: | ||
<translate> | <translate> | ||
− | ====Exporting a | + | ====Exporting a Copy of the Database to Your Computer==== <!--T:23--> |
</translate> | </translate> | ||
Line 92: | Line 91: | ||
# Login to the database that you want to duplicate using phpMyAdmin</translate> | # Login to the database that you want to duplicate using phpMyAdmin</translate> | ||
<translate><!--T:25--> | <translate><!--T:25--> | ||
− | # Click the database name on the left | + | # Click the database name on the left side of the page</translate> |
<translate><!--T:26--> | <translate><!--T:26--> | ||
− | # Select the Export tab</translate> | + | # Select the ''Export'' tab</translate> |
<translate><!--T:27--> | <translate><!--T:27--> | ||
− | # Select the Save as file option</translate> | + | # Select the ''Save as file'' option</translate> |
<translate><!--T:28--> | <translate><!--T:28--> | ||
− | # Click Go</translate> | + | # Click ''Go''</translate> |
<translate><!--T:29--> | <translate><!--T:29--> | ||
− | You'll | + | You'll be prompted to save the database file on your personal computer.</translate> |
<translate> | <translate> | ||
− | ====Importing the | + | ====Importing the Copy into a New Database==== <!--T:30--> |
</translate> | </translate> | ||
<translate><!--T:31--> | <translate><!--T:31--> | ||
− | You'll first need to create the new, empty database on your server using the account control panel. It needs to be UTF8 (utf8_general_ci). After the new database has been created:</translate> | + | You'll first need to create the new, empty database on your server using the account control panel. It needs to be UTF8 (''utf8_general_ci''). After the new database has been created:</translate> |
<translate><!--T:32--> | <translate><!--T:32--> | ||
# Login to the new database using phpMyAdmin</translate> | # Login to the new database using phpMyAdmin</translate> | ||
<translate><!--T:33--> | <translate><!--T:33--> | ||
− | # Click the database name on the left | + | # Click the database name on the left side of the page</translate> |
<translate><!--T:34--> | <translate><!--T:34--> | ||
− | # Select the Import tab</translate> | + | # Select the ''Import'' tab</translate> |
<translate><!--T:35--> | <translate><!--T:35--> | ||
− | # Click the Browse button under | + | # Click the ''Browse'' button under ''File to import'', then select the database file from your computer</translate> |
<translate><!--T:36--> | <translate><!--T:36--> | ||
− | # Click Go to import the database</translate> | + | # Click ''Go'' to import the database</translate> |
<translate><!--T:37--> | <translate><!--T:37--> | ||
− | :'''Hint | + | :'''Hint''' If you see a "No database selected" error, it's probably because you forgot to first click on the database name in the left-hand column.</translate> |
<translate> | <translate> | ||
− | ===Changing configuration.php=== <!--T:38--> | + | ===Changing ''configuration.php''=== <!--T:38--> |
</translate> | </translate> | ||
<translate><!--T:39--> | <translate><!--T:39--> | ||
− | In order to get Joomla to work on the new server, | + | In order to get Joomla to work on the new server, make the necessary changes in ''configuration.php'' to reflect the new server settings.</translate> |
<translate><!--T:40--> | <translate><!--T:40--> | ||
− | You should check/edit the following | + | You should check/edit the following:</translate> |
− | + | <syntaxhighlight lang="php"> | |
− | < | + | var $host = 'localhost'; // usually "localhost". If it's different for your server, your hosting provider should be able to tell you. |
− | var $host = 'localhost'; // usually "localhost". If it's different for your server | ||
var $user = 'the_db_username'; | var $user = 'the_db_username'; | ||
var $db = 'the_databasename'; | var $db = 'the_databasename'; | ||
Line 139: | Line 137: | ||
var $live_site = ''; // is usually empty. | var $live_site = ''; // is usually empty. | ||
var $cookie_domain = ''; // Should be empty. | var $cookie_domain = ''; // Should be empty. | ||
− | </ | + | </syntaxhighlight> |
<translate><!--T:41--> | <translate><!--T:41--> | ||
− | Joomla will work, even if $log_path and $tmp_path are wrong, though you won't be able to install extensions. | + | Joomla will work, even if ''$log_path'' and ''$tmp_path'' are wrong, though you won't be able to install extensions. |
− | Login into the | + | Login into the Backend of your new Joomla site.</translate> |
<translate><!--T:43--> | <translate><!--T:43--> | ||
− | Go to: System | + | Go to: {{rarr|System,System Information,Directory Permissions}}.</translate> |
+ | |||
<translate><!--T:44--> | <translate><!--T:44--> | ||
− | Look at the bottom | + | Look at the bottom four rows:</translate> |
<pre> | <pre> | ||
cache (Cache Directory) Writable | cache (Cache Directory) Writable | ||
− | administrator/cache (Cache Directory) | + | administrator/cache (Cache Directory) Writable |
/var/www/some/other/folder/example.com/logs/ (Log directory) Unwritable | /var/www/some/other/folder/example.com/logs/ (Log directory) Unwritable | ||
− | /var/www/some/other/folder/example.com/tmp (Temp directory) | + | /var/www/some/other/folder/example.com/tmp (Temp directory) Unwritable |
</pre> | </pre> | ||
<translate><!--T:45--> | <translate><!--T:45--> | ||
− | If the | + | If the ''$log_path'' and ''$tmp_path'' are "Unwritable", change the values in ''configuration.php''.</translate> |
<translate><!--T:46--> | <translate><!--T:46--> | ||
− | Use the values of the "Cache Directory" without the | + | Use the values of the "Cache Directory" without the ''/cache/'' part and change ''$log_path'' and ''$tmp_path'' to</translate> |
− | < | + | <syntaxhighlight lang="php"> |
var $log_path = '/var/www/example.com/logs'; | var $log_path = '/var/www/example.com/logs'; | ||
var $tmp_path = '/var/www/example.com/tmp'; | var $tmp_path = '/var/www/example.com/tmp'; | ||
− | </ | + | </syntaxhighlight> |
<translate><!--T:47--> | <translate><!--T:47--> | ||
− | If the Directory Permissions show that | + | If the Directory Permissions show that ''$log_path'' and ''$tmp_path'' are "Writable", you should be able to install extensions.</translate> |
<translate> | <translate> | ||
− | + | ==Copying a Website Using SSH Command Line (Method for Experienced Users)== <!--T:48--> | |
− | ==Copying a | ||
</translate> | </translate> | ||
<translate> | <translate> | ||
− | ===Copying the | + | ===Copying the Files Using a Compressed Archive File Method=== <!--T:49--> |
</translate> | </translate> | ||
<translate><!--T:50--> | <translate><!--T:50--> | ||
− | Copying a large number of individual files using FTP can | + | Copying a large number of individual files using FTP can be unreliable. If you have command-line access to the both source and destination systems, you can create a compressed archive file containing all the files on the source system, then transfer that single file to the destination system where it can be decompressed.</translate> |
<translate> | <translate> | ||
− | ====Creating an | + | ====Creating an Archive File==== <!--T:51--> |
</translate> | </translate> | ||
<translate><!--T:52--> | <translate><!--T:52--> | ||
− | On Unix-style systems ( | + | On Unix-style systems (e.g. Linux) you can use the ''gzip'' program to create ''.zip'' files, or the ''tar'' program to create ''.tar.gz'' or ''.tar.bz2'' files. For detailed instructions, type ''man gzip'' or ''man tar'' at the command line. For example:</translate> |
− | < | + | <syntaxhighlight lang="bash"> |
tar cvfz joomlabackup.tar.gz /path-to-joomla | tar cvfz joomlabackup.tar.gz /path-to-joomla | ||
− | </ | + | </syntaxhighlight> |
<translate><!--T:53--> | <translate><!--T:53--> | ||
− | will create a gzip-compressed archive file, called ''joomlabackup.tar.gz'', containing all | + | will create a gzip-compressed archive file, called ''joomlabackup.tar.gz'', containing all the files in your Joomla! installation.</translate> |
<translate><!--T:54--> | <translate><!--T:54--> | ||
− | '''Important | + | '''Important Note''' Make sure you are '''not''' in the folder you are trying to backup when you run the ''tar'' command or you will create an endless loop.</translate> |
<translate> | <translate> | ||
− | ====Extracting an | + | ====Extracting an Archive File==== <!--T:55--> |
</translate> | </translate> | ||
<translate><!--T:56--> | <translate><!--T:56--> | ||
− | Having copied the archive file to the destination system, you now need to unpack it. | + | Having copied the archive file to the destination system, you now need to unpack it. Use the equivalent command that you used to create the archive file. For example, to unpack the archive file created in the example above, enter:</translate> |
− | < | + | <syntaxhighlight lang="bash"> |
cd /path-to-joomla | cd /path-to-joomla | ||
tar xvfz joomlabackup.tar.gz | tar xvfz joomlabackup.tar.gz | ||
− | </ | + | </syntaxhighlight> |
<translate><!--T:57--> | <translate><!--T:57--> | ||
− | If the user or group IDs are not the same between the source and destination systems, | + | If the user or group IDs are not the same between the source and destination systems, you will need to amend the ownership of the files you just extracted. For example, on an Apache system, you might need to enter the command:</translate> |
− | < | + | <syntaxhighlight lang="bash"> |
cd /path-to-joomla | cd /path-to-joomla | ||
chown -R www-user:www-group * | chown -R www-user:www-group * | ||
− | </ | + | </syntaxhighlight> |
<translate><!--T:58--> | <translate><!--T:58--> | ||
so that Apache has ownership of the Joomla! files. | so that Apache has ownership of the Joomla! files. | ||
− | :''Please ask your hosting provider for the correct group and user names, | + | :''Please ask your hosting provider for the correct group and user names, ''www-group'' and ''www-user'', on your system.''</translate> |
<translate> | <translate> | ||
− | ===Copying the | + | ===Copying the Database with the MySQL Command Line Method=== <!--T:59--> |
</translate> | </translate> | ||
<translate><!--T:60--> | <translate><!--T:60--> | ||
− | Usually you run | + | Usually you run ''mysqldump'' to create a database copy:</translate> |
$ mysqldump -u user -p db-name > db-name.out | $ mysqldump -u user -p db-name > db-name.out | ||
Line 236: | Line 234: | ||
Restore database at remote server (login over ssh):</translate> | Restore database at remote server (login over ssh):</translate> | ||
$ mysql -u user -p db-name < db-name.out | $ mysql -u user -p db-name < db-name.out | ||
− | |||
− | |||
<noinclude> | <noinclude> |
Latest revision as of 00:49, 9 November 2022
Copying a Joomla! website
Copying a Joomla! website is a two-part process: you must copy the files and you must copy the database (which is where the content is stored). Copying the files and copying the database are separate operations. Which you carry out first will depend on your particular circumstances but in most cases it does not really matter. If your website is being updated frequently and you need to take your website offline while the copy takes place, you will probably want to perform the database copy last so as to minimize downtime.
Copying a Website (Common Method)[edit]
Akeeba[edit]
- Akeeba Backup produces a .jpa file
- The .jpa file contains all the folders/files and database files.
- The .jpa file also contains an installer
- Kickstart.php (from Akeeba) unpacks the .jpa file
- You then run the installer and install your site like a Joomla install
- The installer changes the configuration for restoring to a different location and prompts for the new database details.
After you create the Database for your Joomla download and install Akeeba, it can be downloaded from the Joomla extension directory. There is a link to full instructions there as well.
Copying the Files with FTP[edit]
One method of copying the files from one Joomla! installation to another is to use standard desktop FTP software to first download all the files comprising your website from their location on your web server, then upload these files to the location of the new Joomla! installation. Depending on where you're placing the copy of your Joomla! site, the new location could be a different directory on the same web server, or it could be a new location on a completely different web server. When copying a Joomla installation on the same server (i.e. for testing purposes), it is advisable to use a subdomain rather than a subdirectory. This will avoid errors and possible issues in running both installations in unison.
It is important to maintain the same directory structure for all your folders and files as you move them from one location to another. Fortunately, desktop FTP software will handle this automatically as you upload and download sets of files and folders. (Your FTP software should contain Help documentation that explains FTP and how to use the FTP software interface). Note that after you move the files from one location to another, you may still need to edit Joomla! configuration files to get your copy of Joomla! working at the new location; you may also need to change settings for aspects of your web server to get the copy of your Joomla! site working.
In rare instances, a file may become corrupted during an FTP transfer, where only part of the file is successfully transmitted. If you encounter strange or unexpected errors with your new Joomla! installation after you copy over the files, try re-uploading your files in case of corruption during transfer.
Download Files from a Server to Your Computer[edit]
- Use FTP software (e.g. FileZilla) to connect to the server
- Select the directory you want to download (usually /public_html/ or /htdocs/)
- Right click + select files/folder to download, or drag + drop the folder from the "Remote site" view to the "Local site" view
- The downloading of the remote files will start
- After you've downloaded the files, check the "Failed transfers" to see if there were any errors
Upload Files From Your Computer to a Server[edit]
- Make sure that configuration.php has the right settings for the server (especially:localhost, database, database user, database password, log_path, tmp_path)
- Use FTP software (e.g. FileZilla) to connect to the server
- Select the directory you want to upload, and to where (usually to /public_html/ or /htdocs/)
- Right click + select files/folder to upload, or drag + drop the folder from the "Local site" view to the "Remote site" view
- The uploading of the local files to the remote server will start
- After you've uploaded the files, check the "Failed transfers" to see if there were any errors
Copying the Database with phpMyAdmin[edit]
The phpMyAdmin tool can be used to export and import a database, providing a simple way to duplicate a copy of a database using a different name on our servers.
Exporting a Copy of the Database to Your Computer[edit]
- Login to the database that you want to duplicate using phpMyAdmin
- Click the database name on the left side of the page
- Select the Export tab
- Select the Save as file option
- Click Go
You'll be prompted to save the database file on your personal computer.
Importing the Copy into a New Database[edit]
You'll first need to create the new, empty database on your server using the account control panel. It needs to be UTF8 (utf8_general_ci). After the new database has been created:
- Login to the new database using phpMyAdmin
- Click the database name on the left side of the page
- Select the Import tab
- Click the Browse button under File to import, then select the database file from your computer
- Click Go to import the database
- Hint If you see a "No database selected" error, it's probably because you forgot to first click on the database name in the left-hand column.
Changing configuration.php[edit]
In order to get Joomla to work on the new server, make the necessary changes in configuration.php to reflect the new server settings. You should check/edit the following:
var $host = 'localhost'; // usually "localhost". If it's different for your server, your hosting provider should be able to tell you.
var $user = 'the_db_username';
var $db = 'the_databasename';
var $password = 'the_db_password';
var $live_site = ''; // is usually empty.
var $cookie_domain = ''; // Should be empty.
Joomla will work, even if $log_path and $tmp_path are wrong, though you won't be able to install extensions. Login into the Backend of your new Joomla site.
Go to: System → System Information → Directory Permissions.
Look at the bottom four rows:
cache (Cache Directory) Writable administrator/cache (Cache Directory) Writable /var/www/some/other/folder/example.com/logs/ (Log directory) Unwritable /var/www/some/other/folder/example.com/tmp (Temp directory) Unwritable
If the $log_path and $tmp_path are "Unwritable", change the values in configuration.php.
Use the values of the "Cache Directory" without the /cache/ part and change $log_path and $tmp_path to
var $log_path = '/var/www/example.com/logs';
var $tmp_path = '/var/www/example.com/tmp';
If the Directory Permissions show that $log_path and $tmp_path are "Writable", you should be able to install extensions.
Copying a Website Using SSH Command Line (Method for Experienced Users)[edit]
Copying the Files Using a Compressed Archive File Method[edit]
Copying a large number of individual files using FTP can be unreliable. If you have command-line access to the both source and destination systems, you can create a compressed archive file containing all the files on the source system, then transfer that single file to the destination system where it can be decompressed.
Creating an Archive File[edit]
On Unix-style systems (e.g. Linux) you can use the gzip program to create .zip files, or the tar program to create .tar.gz or .tar.bz2 files. For detailed instructions, type man gzip or man tar at the command line. For example:
tar cvfz joomlabackup.tar.gz /path-to-joomla
will create a gzip-compressed archive file, called joomlabackup.tar.gz, containing all the files in your Joomla! installation.
Important Note Make sure you are not in the folder you are trying to backup when you run the tar command or you will create an endless loop.
Extracting an Archive File[edit]
Having copied the archive file to the destination system, you now need to unpack it. Use the equivalent command that you used to create the archive file. For example, to unpack the archive file created in the example above, enter:
cd /path-to-joomla
tar xvfz joomlabackup.tar.gz
If the user or group IDs are not the same between the source and destination systems, you will need to amend the ownership of the files you just extracted. For example, on an Apache system, you might need to enter the command:
cd /path-to-joomla
chown -R www-user:www-group *
so that Apache has ownership of the Joomla! files.
- Please ask your hosting provider for the correct group and user names, www-group and www-user, on your system.
Copying the Database with the MySQL Command Line Method[edit]
Usually you run mysqldump to create a database copy:
$ mysqldump -u user -p db-name > db-name.out
Copy db-name.out file using sftp/ssh to remote MySQL server:
$ scp db-name.out user@remote.box.com:/backup
Restore database at remote server (login over ssh):
$ mysql -u user -p db-name < db-name.out