Installing OroCommerce B2B Application

OroCommerce application version 1.0 has been released last month with a premise that it will „disrupt B2B Online Commerce and „change the world of B2B eCommerce“. With the noticeable rise of Business-To-Business eCommerce in the recent years, it was only a matter of time when the supporting B2B applications and platforms would show up and we at Inchoo are excited to see what OroCommerce brings to the table. We will be taking a look at the installation process and some useful tips on getting started with recently fully-released OroCommerce B2B platform.

Installing OroCommerce on localhost

In this article, I am going to cover general steps when installing OroCommerce on a local development machine. I have successfully installed OroCommerce on both AMPPS and XAMPP local development environments on MacOS and Windows respectively and I will be listing some common general errors that you could encounter and how to fix them.

Step 1: Preparation – Domain and Config

AMPPS – integrated domain creation tool

If you are using AMPPS, you will need to create a new domain using AMPPS Add Domain tool, let’s call it orocommerce.loc and make it point to the web subfolder (orocommerce.loc/web). Also, make sure to check the options “Add an SSL entry” and Add an entry to hosts file”.

XAMPP – manual domain creation

If you are using XAMPP, add the following line to your hosts file:

127.0.0.1 orocommerce.loc

After that, we are going to set up a domain for XAMPP. Open the following file:

xampp\apache\conf\extra\httpd-vhosts.conf

Add the following configuration: 

<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/orocommerce.loc/web"
ServerName orocommerce.loc
ServerAlias www.orocommerce.loc
<Directory "C:/xampp/htdocs/orocommerce.loc/web">
AllowOverride All
Require all Granted
</Directory>
</VirtualHost>

Change the config to fit your path and domain. Save the config and restart Apache. Now you will be able to use orocommerce.loc domain on your local machine.

General preparation

OroCommerce requires PHP 5.6 (or above) and the following configuration in your php.ini file:

  • memory_limit=512M
    • You can also set it to 1024M or higher for better performance
  • date.timezone=UTC

Following PHP extensions are required:

  • ctype
  • fileinfo
  • GD 2.0 and above
  • intl
  • JSON
  • Mcrypt
  • PCRE 8.0 and above
  • SimpleXML
  • Tokenizer

These are the settings you’d have to adjust if you are setting up OroCommerce on your local dev machine for the first time. For the full list of requirements, see OroCommerce System Requirements.

This guide relies on Composer for installation. You can install OroCommerce without Composer and download a full installed package, but you can run into some issues if your system is missing some dependencies. Composer ensures that all necessary dependencies have been installed on your system.

Step 2: Cloning a Git repo and Composer Installation

Before cloning OroCommerce git repo and installing OroCommerce, you will need to setup your database. On a local machine, you can either create a user with an assigned database or use the default root access.

For AMPPS, default username is “root” and password is “mysql” and for XAMPP the username is “root” and password is empty.

After that, open a command line interface and navigate to the localhost folder. In AMPPS that is a www folder, and in XAMPP that is a htdocs folder. If you have used AMPPS Add Domain tool, you will see OroCommerce domain folder (orocommerce.loc) folder. If you are using XAMPP, you will have to create this folder manually. Open the folder in your command line interface and run the following command:

git clone https://github.com/orocommerce/orocommerce-application.git .

This will clone the git repository to the current folder. If there are issues with this command (“folder not empty”), you can run the following command without the dot at the end and copy the content of the orocommerce-application folder to the orocommerce.loc folder and delete the orocommerce-application folder after that.

If you are preferring not to use git, you can download the repository as a .zip file from the git repository and extract the content to your domain folder.

In any case, your domain folder should look like this before installation.

Step 3: Composer Installation

After the contents of the repository have been copied or cloned to the localhost domain folder, you can initiate composer installation with the following command in your command line interface:

composer install --prefer-dist

210 repositories to be installed, this can take a bit longer if you are installing OroCommerce for the first time. With “–prefer-dist” option, this method is faster than regular “composer install” command.  

Composer will then create parameters.yml file and you will be prompted to input database credentials and some other data that can be safely ignored for now. I have used XAMPP’s default “root” username and no password.

Step 4: OroCommerce Installation

After Composer has successfully finished installing the necessary items, you can run the following command inside your command line interface to install OroCommerce:

php app/console oro:install --env=prod

OroCommerce will run the check for the requirements which we have covered in the “Step 1 – Prepararation” section of this article. There are several warnings that you can optionally ignore, mostly related to the PHP accelerator, COM extension and Tidy extension.

If OroCommerce gives you an error during this check, the installation will be canceled until all requirements have been met (except ones marked with “Warning”). You will need to run “php app/console oro:install –env=prod” command again after you have made the necessary adjustments.

If all requirements have been met, OroCommerce will proceed with installing the database. If you get an error during this step, there might be an error with database credentials which you provided during the Composer installation. It is recommended either to start over with a new database or check the following config file:

\app\config\parameters.yml

After the database setup, you will be prompted to enter the admin information, application URL, Organization name and you will be given an option to load sample data (products, categories, CMS, etc.).

This will initiate the final step of the installation where sample data will be installed (if user enabled it), full reindex will occur, translations and assets will be installed and dumped and cache will be cleared.

Please note that the cache cleanup can take a while (whole eternity) when clearing cache during installation or when manually clearing cache during the development. Hopefully, cache clearing time will be improved in the upcoming versions of OroCommerce.

After the installation has been finished, you can open the localhost domain on your browser (in our case, that is orocommerce.loc) and you will be greeted with the OroCommerce demo homepage. Make sure to also check out if the admin is working as expected and that you can log into admin with your set credentials.

OroCommerce command console

You can access the OroCommerce console commands by running the following command in your command line interface while in the OroCommerce installation folder (this may take a while to execute for the first time):

php -f app/console

This will list all available commands. If you need information or help with the commands, you can run the following command:

php -f app/console help command-name

Fixes for common installation issues

Multiple PHP installs issue – specific to MacOS

OroCommerce has a PHP path hard-coded in its installation which can cause issues in some specific cases. This fix applies to the following or similar issues with PHP during the OroCommerce installation step:

  • An issue related to PHP where PHP 5.5 is being detected (5.6 is minimum required) even though higher version of PHP is enabled in AMPPS or other similar software
  • Multiple versions of PHP are installed
  • Missing PHP extensions (intl, for example) even though it is enabled in AMPPS or other similar software

You need to edit your httpd-vhosts.conf file. For AMPPS, that file is located in:

AMPPS/apache/conf/extra/httpd-vhosts.conf

Add the following line after ServerAlias for both VirtualHost and SSL entries for your OroCommerce domain (orocommerce.loc)

SetEnv ORO_PHP_PATH /Applications/AMPPS/php/bin/php

To get a correct path to PHP of your local development environment, you can run a following command from your command line interface: 

which php

Please note that you may need to re-add the SetEnv line each time a new domain has been created if the httpd-vhosts.conf file is refreshed each time new domain has been added. 

Generating Github token for Composer

If you don’t have a Github token added to your Composer installation, you will be prompted to add it during the OroCommerce installation due to the Github’s rate limit. In order to add the token, you will have to:

  • Log into your GitHub account and open Settings
  • Click on Personal Access Tokens in Settings sidebar
  • Click on Generate new token button
  • Add a token description and select public_repo scope under repo and leave other fields unchecked
  • Click on Generate Token button and copy the token
  • Copy the token and paste it into command line interface when prompted

Enabling PHP commands in Windows Command Prompt

In order to enable PHP command in your Windows Command Prompt, you will need to add a new Environment variable:

  • Right click on My Computer and click Properties
  • Under Advanced tab click on Environment Variables
  • Under System Variables, find Path and click Edit button
  • Edit Variable window will open and you need to add a path to php.exe by clicking on New button. For XAMPP default installation, the path is “C:\xampp\php”
  • Save the settings and close the windows

You can test if the path has been added correctly by running the following command in Windows Command Prompt:

php -v

Had an error which isn’t mentioned in this article?

Search through posts or write a post on OroCommerce forums. It is quite active and both users and OroCommerce devs are offering assistance.

I hope you enjoyed reading this article and that it was helpful. In case you need any extra help, get back to us – we would be happy to help you out with setting your store!

Thank you for reading and happy coding.


About Adrian Bece

Frontend Developer

Frontend Developer who is not only fluent in numerous programming languages, he also plays electrical guitar and is avidly interested in hard rock music.

Read more posts by Adrian / Visit Adrian's profile

1 comment

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <blockquote cite=""> <code> <del datetime=""> <em> <s> <strike> <strong>. You may use following syntax for source code: <pre><code>$current = "Inchoo";</code></pre>.