Magento 1.x

How Can We Help?
< Back
Print

 

After downloading and installing OpenLiteSpeed, follow the instructions below to get your Magento site working. The installation process for Magento 1.x and Magento 2.x are slightly different, so please ensure that you are following that steps for the the version you wish to install.

Step 1. Install PHP Modules

The easiest way to install PHP for OpenLiteSpeed is through our CentOS repository. If the LiteSpeed Repository was not already installed and enabled during web server installation, follow this guide to do so.

Step 1.1. Install PHP

Use the following command to install PHP with the required modules:

yum install lsphp56 lsphp56-common lsphp56-gd lsphp56-process lsphp56-mbstring lsphp56-mysql lsphp56-mcrypt lsphp56-pdo lsphp56-xml lsphp56-intl

Note: There are different versions of LSPHP (lsphp53, lsphp54, lsphp55, lsphp56, lsphp70, lsphp71, lsphp72) available. Please check your Magento version for PHP requirements.

Step 1.2. Setup PHP

Direct OLS to the location of the installed PHP binary. (In this example, PHP 5.6 is installed by default in /usr/local/lsws/lsphp56/bin/lsphp.  Now goto WebAdmin Console -> Server Configuration, change the value of the External App > your_external_application > Command setting to reflect the PHP version you are using.)

If you are not using RedHat or CentOS, or you prefer to build PHP manually, see our instructions on Building PHP for Magento.

Magento 2: You will need to set the value of “always_populate_raw_post_data” to -1 in the related php.ini file. In this example, this file would be /usr/local/lsws/lsphp56/etc/php.ini. You should also make any memory configuration changes here if your version of Magento requires it.

For Example:

memory_limit = 768M
max_execution_time = 18000
session.auto_start = 0

Step 1.3. PHP Verification (Optional)

Visit http://your_server_IP:8088/phpinfo.php and make sure PHP Version shows 5.6.x.

Step 2. Setup Magento On A Vhost

Using the default “Example” virtual host:

  1. In the WebAdmin Console, navigate to Virtual Hosts > Example > General > Index Files.
  2. Add index.php.

Step 3. Set up a MySQL database for Magento

Start by installing and starting MySQL:

yum install mariadb-server
systemctl start mariadb

Magento 2: You will need mysql 5.6 or later. More information on installing MySQL 5.6 from a repo

Set new password:

/usr/bin/mysql_secure_installation

Next log into your MySQL server, and create a Magento database instance.

mysql -u root -p

#Enter the following commands while logged in to MySQL.

mysql>create database magento;
mysql>GRANT ALL ON magento.* TO 'magento'@'localhost' IDENTIFIED BY 'magento';
mysql>flush privileges;

Reference.

Step 4. Magento 1.x Installation

Download Magento 1

  1. Register or log in to Magento.com.
  2. Download Magento from their release archive.
  3. copy/ftp the downloaded files into your server’s document root. Magento should be put in a subdirectory of the virtual host. For example, /usr/local/lsws/Example/html/magento. (This puts all the files in the right directory for running Magento on the default “Example” virtual host.)
  4. Using Magento 1.9.3.8 as an example, uncompress the downloaded files with the following command: tar -zxvf magento-1.9.3.8.tar.gz or if its a zip file then unzip magento-1.9.3.1.zip

Change Ownership Of All Files In The Magento Directory

In order for the web server to have write permissions during installation, ownership of the uncompressed Magento Files must be changed to the “nobody” user. Using the default “Example” virtual host, do so with the following command:

chown -R nobody /usr/local/lsws/Example/html/magento

Add The Required Rewrite Rules To Your Virtual Host Settings

Using the default “Example” virtual host:

  1. In the WebAdmin Console, navigate to Virtual Hosts > Example > Rewrite.
  2. Set Enable Rewrite to Yes.
  3. Add the following to the Rewrite Rules setting:
    RewriteBase /magento

############################################
## Uncomment out the next line to enable light API calls processing

#    RewriteRule ^/api/([a-z][0-9a-z_]+)/?$ api.php?type=$1 [QSA,L]

############################################
## Rewrite API2 calls to api.php (by now it is REST only)

    RewriteRule ^/api/rest api.php?type=rest [QSA,L]

############################################
## Workaround for HTTP authorization in the CGI environment

    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

############################################
## TRACE and TRACK HTTP methods disabled to prevent XSS attacks

    RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
    RewriteRule .* - [L,R=405]

############################################
## Redirect for mobile user agents

    #RewriteCond %{REQUEST_URI} !^/mobiledirectoryhere/.*$
    #RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
    #RewriteRule ^(.*)$ /mobiledirectoryhere/ [L,R=302]

############################################
## Always send 404 for missing files in these folders

    RewriteCond %{REQUEST_URI} !^/magento/(media|skin|js)/

############################################
## Never rewrite for existing files, directories, and links

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l

############################################
## Rewrite everything else to index.php

    RewriteRule .* /magento/index.php [L]

MPORTANT : These rules are written for installations located in subdirectory “magento”. If your Magento installation is located in the server docroot instead of the suggested /magento subdirectory, remove “magento” from the rewrite rules containing it. For example, RewriteBase /magento would become RewriteBase /, and RewriteRule .* /magento/index.php [L] would become RewriteRule .* /index.php [L].

Note: These rewrite rules are taken directly from Magento’s official site. Any questions regarding these rules would be best directed to the Official Magento Forums.

Step 5. Perform A Graceful Restart

To make the previous server changes take affect, we must perform a graceful restart.

Step 6. Run The Magento Setup Wizard

In your browser, visit http://your_server_ip:8088/magento and follow the instructions.