Installation Wiki

Installing ExpressionEngine

From InstallationWiki

Jump to: navigation, search
ExpressionEngine
Official Page
Project Documentation
Download
Source Book
200px-184719379X.jpg
ISBN 978-1-847191-44-1
Publisher Packt Publishing
Author(s) Leonard Murphy

Contents

Getting Installed

Before getting started with the installation, you should install XAMPP (or MAMP for Mac users if preferred), and setup the MySQL database that ExpressionEngine will use. In this tutorial, we will walk through the installation process in a local test environment. However, this tutorial can also be used when installing directly onto a live web hosting server.

Following completion of this tutorial, we will be able to:

  • Install ExpressionEngine
o Download the files
o Copy the files to the server
o Go through the installation utility
  • Mask the true location of the ExpressionEngine files by changing where we log into the control panel
  • Use .htaccess to keep our ExpressionEngine URLs user-friendly (optional)

Throughout this tutorial, you will also want to refer to the official installation guide at http://expressionengine.com/docs/installation/installation.html. If you encounter any difficulties during installation, seek help at http://expressionengine.com/forums/ there is a dedicated forum for installation problems.

What Do We Need to Get Started?

ExpressionEngine has certain minimum requirements that can be found at http://expressionengine.com/docs/requirements.html. These include:

  • PHP version 4.1 or newer
  • MySQL version 3.23.32 or newer (not running in strict mode)
  • 10Mb of free space on your server
  • 2Mb of free space in your database (more will be needed as your site grows)

If you have not yet purchased ExpressionEngine and are unsure as to whether your hosting provider meets these requirements, there is a Server Wizard available at the previous URL that can be uploaded to a host server to verify that ExpressionEngine will work.

Although ExpressionEngine can run on either Windows IIS or Apache, this tutorial will assume the use of Apache. Before proceeding, you need to set up a test Apache and MySQL environment on your computer with XAMPP (or MAMP for Mac users if preferred), including the setup of the MySQL database that ExpressionEngine will use and the enabling of mod_rewrite. This allows us to explore the use of ExpressionEngine without having to worry about the nuances between different hosting servers.

Note - Installing ExpressionEngine directly to a hosting server is same as installing it in XAMPP or MAMP.

At this stage, we need to know the following information about the hosting server:

  • The MySQL database name
  • The MySQL server address
  • The MySQL username and password

If you are using XAMPP, this information is established in the XAMPP tutorial. Otherwise, this information would normally have been provided when you signed up for a hosting service. Contact the support department of your hosting provider if you are unsure.

For the optional section on creating user-friendly URLs, there are additional requirements:

  • Your hosting server must run Apache.
  • Your hosting server must have mod_rewrite enabled (see the linked tutorial for doing this in XAMPP).

If this is not the case for your server, you can skip this section ExpressionEngine will still work.

Download the ExpressionEngine Files

The first step in installing ExpressionEngine is to place the ExpressionEngine files on our server. If installing to a web server where an existing website is running, it is recommended to backup the existing website before proceeding.

  1. Once purchased, ExpressionEngine is available as a ZIP file download from the My Downloads section of the www.expressionengine.com website. Download this ZIP file and then unzip the files.
  2. Inside the extracted directory is a subdirectory called system. As the name suggests, this directory contains the important files needed to run ExpressionEngine. It is therefore strongly recommended to rename this directory to something that is known only to you and is not easily guessed. This will protect our files from being accessed by unauthorized individuals.

Upload the ExpressionEngine Files

We now want to copy all the ExpressionEngine files to our server. The directories and files we want to copy are:

  • images\
  • system\
  • themes\
  • index.php
  • install.php
  • path.php


This does not include the following directory and file, which do not need to be uploaded when installing for the first time: system\updates\ system\update.php

All these files are found in the extracted ExpressionEnginex.x.x directory, where x.x.x represents the version of ExpressionEngine being installed (e.g. 1.6.4).

  1. If using XAMPP, we can simply copy-and-paste all the files in the extracted ExpressionEnginex.x.x directory to C:\xampp\htdocs\ (do not copy the ExpressionEnginex.x.x directory itself). If you are using MAMP on a Macintosh, copy-and-paste to /Applications/MAMP/htdocs/. If you are using an actual website, upload these files directly to a web hosting server via an FTP program.
  2. If the system\update.php file or the system\updates\ directory has been uploaded, delete them now. (These are for when we need to update ExpressionEngine to the latest release, and pose a slight security risk if left on the server). The system directory should look like the following screenshot:
  3. Next, we need to change the permissions of certain files. Note - There is no need to change any file permissions when using ExpressionEngine with XAMPP or MAMP on a local computer. These steps only apply when installing directly to a web hosting server.
  4. In most FTP clients, right-click on the file to change the permissions. The following files must be set to 666 on a UNIX server, or set as writeable on a Windows server. 666 means that the owner, group, and the public can read and write to these files. path.php system\config.php system\config_bak.php We also need to set the permissions on the following directories to 777 on a UNIX server, or set as writeable on a Windows server. 777 means that the owner, group, and the public can read, write, and execute the files in these directories. images\avatars\uploads\ images\captchas\ images\member_photos\ images\pm_attachments\ images\signature_attachments\ images\uploads\ system\cache\
  5. The ExpressionEngine website offers a variety of site themes that can also be downloaded and installed. They are available at http://expressionengine.com/templates/themes/category/site_themes/. Note - If you are interested in using a different theme, you may want to upload the files to your site before you install ExpressionEngine.

Install ExpressionEngine

Now that the ExpressionEngine files are in place and the permissions have been set, we are ready to install ExpressionEngine. This is done entirely in the web browser.

  1. First, navigate to the install.php file (http://localhost/install.php or http://www.example.com/install.php) and click on Click here to begin!.
  2. On the next page, we will have to agree with the license Terms and Conditions, then click Submit.
  3. When we downloaded our ExpressionEngine files, we renamed our system directory. Type in what you renamed this directory to, so that ExpressionEngine can find the installation files. Then click Submit.
  4. We will now be prompted for various settings.
  5. The Server Settings will prefill many of the fields correctly. The index page of the site is index.php. The URL of the site is the domain (http://localhost/ or http://www.example.com/). If you installed in a subdirectory, the URL will include the subdirectory. Enter your email address as the webmaster. If you are on a Windows server, select Windows as the type of server. If using XAMPP, MAMP or any other Apache server, choose Unix. If in doubt, choose Unix (more common).
  6. While setting up the database we established the MySQL Database Settings for our test environment, which were localhost for the MySQL Server Address, eeuser for the MySQL Username, and ee for the MySQL Database Name. Your hosting provider would have provided the settings for your website. Enter the server address (usually an IP address or localhost), username, password, and database name that they provided. You can leave the Database Prefix as exp, and the database connection as non-persistent.
  7. The 'Encr'yption Settings can be left as SHA-1, as SHA-1 is the successor to MD5 and is more secure.
  8. Choose the username, password, email address, screen name, and site name to Create your Admin Account in ExpressionEngine. These can be anything, but do not forget the username or password.
  9. Choose the appropriate time zone in the Localization Settings, and if you downloaded additional themes, you can also Choose your default template design.
  10. When ready to proceed, click on Click Here to Install ExpressionEngine. A success page with two links should then load one link will go to the control panel and the other to the ExpressionEngine home page.
  11. Follow the link to the ExpressionEngine home page (http://localhost/index.php or www.example.com/index.php) to verify that the main page is a working example website. It should look similar to the following screenshot (though you may have chosen a different theme).
  12. Finally, delete the install.php file from the root of your website using an FTP program. In most FTP clients, you can right-click on the file and select Delete. If you are using XAMPP or MAMP, the file will be located in C:\xampp\htdocs\install.php or /Applications/MAMP/htdocs/install.php respectively.

Logging into the Control Panel

We have already taken a step to mask the location of our installation files. This was done by renaming the system directory. Taking this one step further, we can change where we log into the control panel, so that we do not reveal our installation directory when we give others access to the control panel.

  1. Copy (do not move) the file system\utilities\admin.php to the root of the ExpressionEngine website, where the path.php file is.
  2. Now try logging into the control panel by pointing a browser at http://localhost/admin.php or http://www.example.com/admin.php and using the username and password chosen during installation.

Creating User-Friendly URLs

Every ExpressionEngine page includes the rather ugly index.php in the address, such as http://localhost/index.php/site/about/ or http://www.example.com/index.php/site/about/.

The http://localhost/index.php returns the same page as http://localhost/, so many people prefer to rename or suppress the index.php altogether. It is better to do this before we start developing a site than when we already have links incorporating the index.php.

Removing the index.php entirely is not an officially supported technique. Not all hosting providers support the use of .htaccess, and different servers can require slightly different commands.

Although many people do choose to remove index.php, many others prefer to rename it rather than remove it, using a word that fits in with the overall theme of the site. Renaming index.php is officially supported and can look just as seamless to your visitors, though to remove the extension still requires the use of .htaccess.

Neither removing nor renaming index.php is required for ExpressionEngine to function.

Hiding the index.php in ExpressionEngine URLs

If your hosting provider uses Apache and the server recognizes .htaccess files (that is, has mod_rewrite enabled), we can do this by creating a .htaccess file.

  1. Open Notepad or any other plain text editor and save the blank file as .htaccess (there are no letters before the period but the period is important; htaccess is the extension).
  2. In this file, type the following three lines:
    RewriteEngine on
    
    RewriteCond $1 !^(images|system|themes|index\.php|admin\.php) [NC]
    
    RewriteRule ^(.*)$ /index.php/$1 [L]
    

    Note - During installation, we renamed the system directory to a different name, so replace system with that name instead.

    This essentially says to parse all files as if the index.php file is there, except for the files and directories listed between the brackets in the second line. If there are files or directories beyond those listed, also add them to the list in the second line, each separated with a | character. The path.php does not need to be listed here as it is never accessed directly via a web browser.

    This is called the exclude method because we are excluding those files not to be treated as ExpressionEngine files.

  3. Save this file to C:\xampp\htdocs\.htaccess if using XAMPP, /Applications/MAMP/htdocs/ if using MAMP on the Macintosh, or upload .htaccess to the root directory of the ExpressionEngine website. Note - If using IIS on a Windows Server, the same effect may be achievable by renaming .htaccess to httpd.conf. The function ISAPI_Rewrite must be enabled on the server.
  4. Finally, log into the control panel (http://localhost/admin.php or http://www.example.com/admin.php) and select Admin | System Preferences | General Configuration. Now, change the Name of your site's index page field from index.php to nothing.
  5. Open http://localhost/site/about/ or http://www.example.com/site/about/. If it looks like the following screenshot, the changes were successful. If the changes were not successful, your hosting provider may not support the commands we are using in the .htaccess file. In this case, change the Name of your site's index page back to index.php and delete the .htaccess file from your server in order for ExpressionEngine to keep working.

Note - If you are unable to remove the index.php from your URLs, it is also possible to rename it see the next section.

Renaming index.php in ExpressionEngine URLs

If you have successfully removed the index.php from ExpressionEngine URLs using the previous technique, then you can skip this section.

Whether due to technical limitations or personal preference, renaming the index.php is also popular. The easiest way to do it requires keeping the .php extension:

  1. In the root folder of your server, or in C:\xampp\htdocs or /Applications/MAMP/htdocs/, rename the file index.php to any other name that ends in .php (for example, toast.php).
  2. Next, log into the control panel (http://localhost/admin.php or http://www.example.com/admin.php) and select Admin | System Preferences | General Configuration. Now, change the Name of your site's index page field from index.php to the new name. This will ensure that any ExpressionEngine generated links include the new name.

    If you wish to remove the .php extension entirely, your server must use Apache and have mod_rewrite enabled (that is, recognize .htaccess files).

  3. Follow the previous two steps to rename the index.php file to a name without an extension (for example, welcome), and set the ExpressionEngine control panel accordingly.
  4. Open Notepad or any other plain text editor and save the blank file as .htaccess (there are no letters before the period but the period is important; htaccess is the extension).
  5. In this file, type the following to parse the files named welcome (or whatever you choose) as a PHP file, even though it does not have a PHP extension.
    DirectoryIndex welcome index.php
    
    <Files welcome>
    
    ForceType application/x-httpd-php
    
    </Files>
    
  6. Save this file to C:\xampp\htdocs\.htaccess or /Applications/MAMP/htdocs/.htaccess, or upload .htaccess to the root directory of the ExpressionEngine website.
  7. Open http://localhost/welcome/site/about/ or http://www.example.com/welcome/site/about/. If you get the same style webpage we received after our initial installation, the changes were successful. If the changes were not successful, you want to make one of the following two changes to your .htaccess code:
    <Files welcome>
     ''' AcceptPathInfo on'''
     ''' SetOutputFilter PHP'''
     ''' SetInputFilter PHP'''
    
    </Files>
    

    Or

    <Files welcome>
     ''' SetHandler application/x-httpd-php'''
    
    </Files>
    
  8. If neither of those alternatives works, your hosting provider may not support the commands we are using in the .htaccess file. In this case, rename the file on your server so that it once again has a .php extension, change the Name of your site's index page back to reflect the same name, and delete the .htaccess file from your server in order for ExpressionEngine to keep working.

Source

The source of this content is Chapter 2: Getting Installed of Building Websites with ExpressionEngine 1.6 by Leonard Murphy(Packt Publishing, 2008).

Personal tools