x
 
Create New Page

Revision: Complete copy of the website on localhost

Revision from: 09:45, 24 Feb 2008

Here are the steps to go through if you want to have wholly functional copy of your website on localhost.

For the sake of presentation some things are assumed:
1. OS is Windows
2. Apache, PHP and MySQL distribution is EasyPHP 2.0 beta 1
3. Forum module is being used
4. “Edit Menu” extension is being used
5. “Comment HTML Formatting Buttons” and “Allow EEcode” plugins are being used
6. Website’s host is EngineHosting
7. In the website’s pages “src” attributes of the <img> tags are not harcoded, but set using global template variable “image_upload_folder”
8. Links which point to other pages in the same website are not hardcoded but set using variable {path=“site_index”}

Some steps are specific to module, extension, plugins and global template variable mentioned above, but you may need to perform analogous steps for add-ons and variables you use.

I. Local Host and ExpressionEngine preparation:

1. Install EasyPHP 2.0b1 in c:\EasyPHP\ .

2. Right-click EasyPHP quick-launch icon, go Configuration\PHP. It will open php.ini file. Make following changes in this file:
  a) max_filesize = 2000M
  b) memory_limit = 2000M
  c) post_max_size = 2000M
  d) max_execution_time = 0
 
3. Open file c:\EasyPHP\phpmyadmin\libraries\import\sql.php and type after the line “/* SQL import plugin for phpMyAdmin */” following line:
“set_time_limit(0);” .

4. Restart EasyPHP.

5. Right-click EasyPHP quick-launch icon and click Administration.Your default browser will be started and the page http://127.0.0.1/home/ will be opened.
Now click the link “phpMyAdmin”. Then create database “my_database” using collation “utf8_general_ci” .

6. Copy ExpressionEngine’s files into folder c:\EasyPHP\www\ .
Then right-click EasyPHP quick-launch icon, click “Local web” and install ExpressionEngine entering “system” as system folder and “root” as MySQL username, “my_database” as database name.

7. Go to www.expressionengine.com and download plugin “Comment HTML Formatting Buttons” and unzip it to c:\EasyPHP\www\system\plugins\ directory.
Once the plugin is copied, you should be able to see it CP Home >  Admin >  Utilities >  Plugin Manager. Then open file c:\EasyPHP\www\system\config.php and
type the line “$conf[‘remove_close_all_button’] = ‘y’;” .

8. Go to www.expressionengine.com and download plugin “Allow EEcode” and unzip it to c:\EasyPHP\www\system\plugins\ directory. Once the plugin is copied, you should be able to see it CP Home >  Admin >  Utilities >  Plugin Manager.

9. Go to www.expressionengine.com and download Forum module. Unzip it.
  a) Inside you will find “forum” directory; copy it to c:\EasyPHP\www\system\modules\ .
  b) Inside you also will find “forum_themes” directory; copy it to c:\EasyPHP\www\themes\ .
  c) Inside you also will find “forum_attachments” directory; copy it to c:\EasyPHP\www\images\ .
  d) Inside you also will find two files - lang.forum.php and lang.forum_cp.php; copy them to c:\EasyPHP\www\system\language\english\ .
  e) Go to local website’s Control Panel, open Modules tab. You will see entry listed for the “Discussion Forum”. On the right side click “Install”; forum module will be installed.

10. Go to http://expressionengine.com/forums/viewthread/68277/ , download Edit Menu extension and unzip it to c:\EasyPHP\www\system\extensions\ directory.
Once the extension is copied, you should be able to see it CP Home >  Admin >  Utilities >  Extension Manager. If it is not enabled, enable it.

II. Restoration of the website on the local host:

11. Go to https://secure.enginehosting.com/controlpanel/ and log into Web-based FTP and File Manager. Go to public_html/images/uploads/ and download all images. Then copy all images to c:\EasyPHP\www\images\uploads\ .

12. Open website’s phpMyAdmin > databases > my_database > export . Select “drop table”, select “Save as File” and press button “Go”. The database will be exported.

13. Open export file in texxt editor and delete or comment the line “CREATE DATABASE `my_database` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; USE `my_database`;” .

14. Go localhost> phpMyAdmin > databases > my_database > import, select file to be imported, select Character set of the file “utf-8”, deselect “Allow interrupt of import in case script detects it is close to time limit” and push “Go” button. Database will be imported; it may take several minutes to complete.

15. If local website’s Control Panel looks unstyled, go to c:\EasyPHP\www\themes\ and copy folder “cp_themes” to c:\EasyPHP\www\system\ . ExpressionEngine will discover it and Control Panel will be styled properly.

16. Log into local website’s Control Panel, go Admin >  System Preferences >  General Configuration and make sure that
  a) URL to the root directory of your site is http://127.0.0.1/
  b) URL to your Control Panel index page is http://127.0.0.1/system/index.php
  c) URL to your “themes” folder is http://127.0.0.1/themes/
  d) Theme Folder Path is C:/EasyPHP/www/themes/ [To figure out absolute path of the server, allow PHP for any template in template group preferences and type this code into that template <?php echo dirname ($_SERVER[SCRIPT_FILENAME]) . ‘/’; ?>]
  e) Default Language is English
  f) Default Character Set is utf-8
  g) Default XML Language is English
  h) Name of your site’s index page is index.php
 
17. Go Admin > System Preferences >  Captcha Preferences and change
  a) Server Path to Captcha Folder to C:\EasyPHP\www\images\captchas\ [To figure out absolute path of the server, allow PHP for any template in template group preferences and type this code into that template <?php echo dirname ($_SERVER[SCRIPT_FILENAME]) . ‘/’; ?>]
  b) Full URL to Captcha Folder http://127.0.0.1/images/captchas/
 
18. Go Admin > System Preferences > Emoticon Prefrences and change “URL to the directory containing your smileys” to http://127.0.0.1/images/smileys/ .

19. Go Admin >  Weblog Administration >  File Upload Preferences >  Edit and change
  a) Server Path to Upload Directory to C:\EasyPHP\www\images\uploads\ [To figure out absolute path of the server, allow PHP for any template in template group preferences and type this code into that template <?php echo dirname ($_SERVER[SCRIPT_FILENAME]) . ‘/’; ?>]
  b) URL of Upload Directory to http://127.0.0.1/images/uploads/
 
20. Go to Admin >  Weblog Administration >  Weblog Management >  Edit Weblog > Path Settings for every weblog and change Weblog URL so that the first part of it would be http://127.0.0.1/index.php . If you have many weblogs, to do this would be tedious. In this case you may do following. Go Admin > Utilities > Find and Replace. Select, at the top, “Site Preferences” and the name of the site you are working with. Then in the box that says “Search for this text”  enter “http://the_wrong_site_url.net/index.php”. Into the next box that says “And replace it with this text” enter “http://127.0.0.1/index.php”. Hit submit and it is done in a flash! 

21. Go to My Account > Extras >  Quick Links and change Link URL of My Weblog into http://127.0.0.1/index.php/ .

22. Log into Control Panel of local website, go Templates > Global Variables and change variable “image_upload_folder” to “http://127.0.0.1/images/uploads/” . Now in local webpages all images should be displayed .

That’s it! You have complete and wholly functional copy of your website on the local host.

[Addition by tbritton]
Additionally, you can use the {site_url} variable in the paths settings to take care of step 20, having only to change the URL to site entry in System Preferences, General Settings then to update the lot of them. No slash after {site_url} is needed -> {site_url}index.php/template_group/template
(thanks to Michael Boyink for this tip)

[Addition: I use XAMPP for Windows from Apache Friends ]

Category:Local EE Installation - Category:Installation - Category:DatabaseCategory:Exporting