Magento Installation Guide

System Requirements

At the base level, Magento will require the following software. (You can check your system compatibility using this testing script.)

1 – Linux, Windows, or another UNIX-compatible operating system

2 – Apache Web Server (1.x or 2.x)

3 – PHP 5.2.0 or newer, with the following extensions/addons:

  • PDO/MySQL
  • MySQLi
  • mcrypt
  • mhash
  • simplexml
  • DOM

4 – MySQL 4.1.20 or newer

  • InnoDB storage engine

5 – Sendmail-compatible Mail Transfer Agent (MTA)

  • Magento will connect directly to an SMTP server if you don’t have an MTA

We also recommend the use of APC as a bytecode cache for performance improvements. You can find it in the PECL archives here: http://pecl.php.net/package/APC. Other bytecode cache systems are not supported at this time. TEO DNS resolution (important when installing on localhost)

During the installation process Magento will set cookies and most browsers will refuse to accept cookies for localhost. This can lead to several problems but no error messages. E.g. when trying to set the locale the page will just refresh and revert to the standard En-US locale..

To avoid this problem, you can set up Magento to use 127.0.0.1 as its domain name or create another entry for localhost in your computer’s /etc/hosts file and use that hostname to access the site, as shown below:

127.0.0.1 localhost www.localhost.com

PHP memory You may encounter problems when displaying product images if your memory limit is too low. If you plan to upload high resolution images I would recommend setting memory_limit = 32M in your php.ini


Installing Magento Using the Downloader

This document covers the installation process for Magento using the Magento Downloader. The downloader reduces the size of files that need to be FTP‘ed from your local computer up to your server. When using the downloader, you just FTP the downloader to the server and when it is run, the downloader will fetch all of the Magento files for the current stable release. If you have downloaded the downloader package from magentocommerce.com, then follow this guide to complete the installation.

Instructions

1. Download the .zip or .tar.gz installer package from the Magento website and decompress it.

2. Upload all the decompressed files to your web server via FTP. Be sure to install to your public HTML file.

3. Create a MySQL database and user/password for Magento

  • You must install sample data before you run the installer.
  • The sample data is also available from the Magento website in the same download page as the installer.
  • This step varies by hosting provider and is out of the scope of this document. Consult your provider’s support/documentation for instructions on how to do this.

4. The top-level Magento directory (the one you uploaded the decompressed files to) must have the correct permissions in order for the installer to proceed. To do so, navigate to the directory with your FTP client. Then locate the function “Change Permissions” or “Change Mode” in your FTP client and select it. Once you find the function, you must set the permissions so the web server can write to this file. There are two typical ways of representing file permissions in Linux:

  • As a number (eg, 755)
  • As a series of permissions categorized into user, group, and other

If your FTP client uses the first representation, set the permissions on the directory to be 777, or 0777. If your FTP client uses the second representation, set the permissions as shown in the image below.

777_file_permissions.jpg

For more details about permissions please see this article: Magento Filesystem Permissions

5. If your server primarily runs PHP4 then you will require the PHP5 CGI Binary in order to continue. Please read the PHP5 CGI Setup appendix below and complete it before continuing to Step 6.

6. If your server runs Apache 2, it may require adding the following to a .htaccess file in the root of your Magento installation:

AcceptPathInfo On

7. Now use your web browser to surf to the Magento installation wizard. If you’ve uploaded the Magento files to http://www.example.com/magento/, then the wizard will be located here: http://www.example.com/magento/downloader.

8. Since you are using the installer version, the downloader will be the first installation process to run. It will attempt to download all the necessary components for a complete Magento install. If you notice a few “Warning” messages zip by on the green-on-black screen, don’t worry too much about it. The installer will detect an overall success or failure, and if you see the “Continue magento Installation” button at the end (usually takes about 5 minutes) then the process has succeeded. Click the “Continue Magento Installation” button to continue on to the regular installer wizard.

9. Once in the wizard, you can configure various system-level settings that are required for Magento to function. Most options will be intelligently guessed for you, but you’re free to override any settings that don’t look right. At the very least, change the database parameters in the first box, “Database connection”, to match those of the database you set up in Step 3.

10. Success! You’ve completed a Magento installation. You can now visit the administration backend and begin configuring your new online store.


Installing Magento Using the Full Release Package

This document covers the default installation process for Magento. If you have downloaded one of the full release distributions from magentocommerce.com, follow this guide to complete the installation.

Instructions

1. Download the .zip or .tar.gz file from the Magento website and decompress it.

2. Upload the Magento web files to your web server via FTP

3. Create a MySQL database and user/password for Magento

  • This step varies by hosting provider and is out of the scope of this document. Consult your provider’s support/documentation for instructions on how to do this.

4. Ensure that the directories app/etc , var , and media are writable by the web server. To do so, navigate to the directory with your FTP client. Then locate the function “Change Permissions” or “Change Mode” in your FTP client and select it. Once you find the function, you must set the permissions so the web server can write to this file. There are two typical ways of representing file permissions in Linux:

  • As a number (eg, 755)
  • As a series of permissions categorized into user, group, and other

If your FTP client uses the first representation, set the permissions on each directory to be 777, or 0777. If your FTP client uses the second representation, set the permissions as shown in the image below.

777_file_permissions.jpg

5. If your server has suPHP or suEXEC enabled, you will need to use permission 755 instead of 777.

6. If your server primarily runs PHP4 then you will require the PHP5 CGI Binary in order to continue. Please read the PHP5 CGI Setup appendix below and complete it before continuing to Step 6.

7. Now use your web browser to surf to the Magento installation wizard. If you’ve uploaded the Magento files to http://www.example.com/magento/, then the wizard will be located here: http://www.example.com/magento/downloader.

8. Once in the wizard, you can configure various system-level settings that are required for Magento to function. Most options will be intelligently guessed for you, but you’re free to override any settings that don’t look right. At the very least, change the database parameters in the first box, “Database connection”, to match those of the database you set up in Step 3.

9. Success! You’ve completed a Magento installation. You can now visit the administration backend and begin configuring your new online store.


Appendix: PHP5 CGI Setup

Some hosting providers do not yet provide PHP5 on their servers, opting instead to stay with PHP4 for the time being. As Magento is a PHP5-only application, this can be a barrier for some users. This document outlines a possible workaround for such a scenario. The goal is to install PHP5 as a CGI binary and configure the web server (Apache) to use it instead of the default PHP4.

Requirements

Every hosting provider has a slightly different way of doing things, so it’s important to know if this method will work with your provider before continuing. Below is a list of the basic requirements that this document requires. If you’re unsure as to whether your provider supports these requirements, pass the list along to them and find out.

  • Operating System: Linux
  • Web Server: Apache with CGI support
  • FileInfo override control via .htaccess files
  • A user-writable cgi-bin directory
  • FTP access to your web root and cgi-bin directories

Instructions

Step 1: Upload the PHP5 CGI binary

It is possible to compile a PHP5 binary yourself, but for the purposes of this solution, we’ve provided one for you. You can download it here: http://www.magentocommerce.com/support/php5cgi/php5-cgi

Once downloaded, use your FTP client to upload the file to your cgi-bin directory. If you don’t know where your cgi-bin directory is, ask your hosting provider.

After uploading, use your FTP client to set the proper mode on the php5-cgi file. This function varies for each FTP client, but it usually called “Change Permissions” or “Change Mode” or “Chmod”. Once you find the function, you must set the permissions so the web server can run this file. There are two typical ways of representing file permissions in Linux:

  1. As a number (eg, 755)
  2. As a series of permissions categorized into user, group, and other

If your FTP client uses the first representation, set the permission on the php5-cgi binary to be 755, or 0755. If your FTP client uses the second representation, set the permissions as shown in the image below.

755_file_permissions.jpg

Step 2: Modify the Magento .htaccess file

By default, the web server will want to run the Magento application using PHP4, which will not work. In order to point it to the new PHP5 CGI binary, you must modify the .htaccess file in the Magento top-level directory.

Using your FTP client, edit the file .htaccess in your top-level magento directory.

The file is somewhat long so we won’t list it all here. But the first few lines at the top should look like this:

cgi_htaccess_file.jpg

First, remove the # symbol from the beginning of the last three lines listed in the excerpt above. This will enable the special CGI handler for your Magento site. Next, you’ll want to modify the path in the Action line to point to the location of the php5-cgi binary you uploaded in Step 1. This path should be relative to the web root of your site.

That’s it! You can now proceed with the rest of the Magento installation using one of the methods described above.

Troubleshooting

I still see “Invalid PHP version” when visiting my Magento page.

This probably means that your hosting provider does not allow the FileInfo overrides via .htaccess files. This is a necessary requirement for this solution, so you’ll have to ask your hosting provider for it.

I see “Internal Server Error” when visiting my Magento page.

This is a typical error message when a CGI binary quits unexpectedly, and could be caused by a number of things. If you have access to your server’s Apache error log, you can look there for some clues. We’ll cover a few more common issues here.

  1. Bad location to the PHP5 binary. Make sure the AddHandler directive in your .htaccess file is pointing to the correct location for the PHP5 binary. You can often test it by trying to surf to the location with your web browser. For example, if your site is www.example.com and your PHP5 location is /cgi-bin/php5-cgi , try visiting http://www.example.com/cgi-bin/php5-cgi with your web browser. If you see an “Internal Server Error” message, then that means your PHP5 binary is in the correct location. If you get a “File not found” message, then this is not the correct location.
  2. Bad permissions on the PHP5 binary. Double check the permissions on the PHP5 CGI binary you uploaded in Step 1. They should be 755 or “rwxr-xr-x”, depending on your FTP client’s representation.

3 thoughts on “Magento Installation Guide

Leave a Reply