Since OpenCart is a considerably new online shopping cart solution, many web hosting service providers do not have one-click installation for OpenCart yet. So, we will need to install OpenCart ourselves.
Installation of OpenCart is an easy task and follows a standard procedure like PHP and MySQL-based open source software. On the other hand, there are some important key points we should be careful at.
In this chapter we shall:
Learn the system requirements needed to install OpenCart
Learn to download and upload OpenCart files to a web server
Learn to set file and folder permissions
Learn to create a MySQL database and user
Learn to complete installation with the OpenCart wizard
This chapter is suggested for reading even if you are a tech-savvy computer user, as you can eliminate the possible problems while installing OpenCart.
By the time of the writing of this book, the latest OpenCart release is 1.4.7 and the system requirements are valid for this version. Previous versions can need the same or fewer requirements.
We would suggest installing v1.4.7 and reading the book carefully. If there are new releases of OpenCart after the publication of this book, you can at any time download it from the OpenCart website and see the differences easily because you will already have a strong foundation in OpenCart after completing the book.
We must download and install OpenCart on our own or on a shared web hosting solution. OpenCart system can run on an Apache or Windows server. Currently, OpenCart supports only MySQL database. Overall, OpenCart was designed to work flawlessly on an ideal LAMP solution (Linux, Apache, MySql, and PHP), but it is also possible to run using a Windows server, MySQL, and PHP.
If you aim to run OpenCart on Windows, you can use WAMP Server. It is available for download at http://www.wampserver.com/en/.
The following screenshot shows the minimum system requirements for OpenCart for installation and running without problems.
You should contact your hosting provider if you are not sure whether these settings are set or not.
We will talk about SEO in OpenCart in Chapter 4, Configuring Store Settings.
Be sure that your web hosting solution meets the previous requirements before starting installation steps. The easiest way of determining this is to send a requirement list to web server technical support. We will complete installing OpenCart using the following sections:
Downloading OpenCart from http://opencart.com
Uploading OpenCart files to a web host
Creating MySQL database and a user for OpenCart
Using OpenCart installation wizard
Deleting installation files after completion
Browsing to online storefront
Making first login to OpenCart administration interface
Now, let's start to explore each section in detail.
In this section, we are going to download OpenCart archive file.
We browse to the http://www.opencart.com/index.php?route=download/download link. This page will list the latest OpenCart version. The download page is similar to the following screenshot.
We can see the full list of OpenCart versions on: http://code.google.com/p/opencart/.
Let's click on the link and choose the Save File option to save it in the computer:
There are two common methods for uploading files to a web host:
Using cPanel File Manager Utility
Using an FTP Client
We will learn both the methods with examples.
The first method is suggested because we can upload the installation files faster to the host.
We suggest installing OpenCart on a directory, such as http://yourwebsite.com/store
By doing this, we will able to close the shop temporarily if we need to later, without affecting the root domain at http://yourwebsite.com.
Let's start with the suggested cPanel method.
This is the first method of uploading OpenCart files to a web host. Many modern web hosting solutions include a control panel called cPanel, and we can use the cPanel File Manager utility to directly upload a ZIP file to web host and decompress the files there easily.
In this example, we will install OpenCart on the store directory.
You can generally reach cPanel on http://yourwebsite.com/cpanel with the username and password which the hosting provider emailed to you upon registration.
Let's open File Manager utility at cPanel.
It will choose the Web Root as default. We will continue with the Go button.
Let's choose OpenCart ZIP file using the Browse button on the next screen. After the upload completes, we return back to the main cPanel File Manager screen.
We will right-click on the file and select Extract.
It will open a pop-up window. Just press the Extract File(s) button to decompress the ZIP file into the root web folder.
All files were extracted into a folder named
We will need to browse into this folder first. We see a folder called upload under it. We will need to rename it as store at first.
Right-click on it and choose Rename from the menu.
Rename the directory as store, as in the following screenshot:
We will need to move the renamed store directory to the root. Let's right-click on the store directory and choose Move from the menu.
Change the destination directory as /public_html/ and click on Move File(s) button.
OpenCart files are now on the web host in a subdirectory. Our online store will be reachable at http://yourwebsite.com/store after completion of all the remaining installation steps.
If you have already used the first method (Uploading Files using cPanel) please skip this action and continue with Setting File Permissions.
In this section, we will learn how to decompress the OpenCart files in a local folder and upload to the root of web server using an FTP Client.
Right-click on the previously downloaded OpenCart file on your computer and click Extract Here option.
As a result, we will have a folder named
opencart_v1.7with the structured folders and files inside.
We will create a directory named as store on the root of the website using the ftp Make Directory command.
Upload all the files and the subfolders in
opencart_v1.7/uploadfolder to the web host in the
/storefolder. We use a free FTP client software called CoreFTP, which can be downloaded at http://www.coreftp.com/. Choose all the files and folders in the directory from the left panel and drag and drop into the right panel where the web root folder exists. In most cases, it is
/wwwfolder. So, our destination is
The following screenshot shows the process before dragging and droping the files:
And the screenshot after uploading the files to the folder named as store is as follows:
Notice that it is a time consuming process since there are many files in OpenCart system. Let's wait until all the files are uploaded to the web server.
We have uploaded all OpenCart files and subfolders to the store directory on the website using an ftp client.
So, our online store will be reachable at http://yourwebsite.com/store after completion of all installation steps.
Suppose that we have a very slow internet connection and want to install OpenCart on a web host without any possible interruptions on file transfer. Which upload method is more effective in terms of speed and reliability?
Using an FTP Client program.
Using cPanel File Transfer Utility.
OpenCart system uses its several directories dynamically to create, change, and delete the files when needed. Because of this, we have to be sure that the correct file permissions are applied on these files and folders.
Now, let's see how we will set the permissions using cPanel File Manager:
We should be sure that the following directories and config files are writeable, meaning that their permissions are set to at least 755. We can check this by using cPanel file manager.
Some hosting systems require 777 permissions for OpenCart to work properly. If the installation screens which we will soon learn give such unwritable errors, then we should set permissions to 777 and try going through with the installation screen again.
The following screenshot shows that all these directories are set to 755 properly, but
config.phpfile is not set to 755:
Set Permission level to 755. Click the Change Permissions button.
We must repeat this process for all the folders listed below including the subfolders and files inside one by one if not set correctly to 755:
We have set the needed file and folder permissions to 755. It was needed for OpenCart to install and operate correctly. Depending on our hosting provider's linux settings, we might need 777 as well.
Curious readers can learn more about server security on this http://www.unix.com/unix-dummies-questions-answers/33137-chmod-777-security-risks.html link.
This step is needed for OpenCart to connect and store all the data in a MySQL database. We will learn how to create a new database and user for this database. We will later use this information in OpenCart Installation wizard.
We will use MySQL Databases link on cPanel. Even though there can be slight differences on different cPanel versions, the main idea and the process is the same.
Click on MySQL Databases link on cPanel:
Enter a name for the database. Here, we named the database as opencart. Then, click on the Create Database button.
If we are on a share hosting, a prefix will be added automatically to the name we provided. This is generally the username which we use to log in to the cPanel. So, your database name will follow the template of
Take a note of the database name including the prefix.
Now, let's create a user and assign this user to our newly created database. We go back from database creation result page and jump to MySQL Users section.
Choose a username and password. Repeat the password on the last text box and be sure that the password is not very easy to guess for security preferably a mixture of letters and numbers.) We have chosen dbuser as the username. Click on the Create User button after filling all the required textboxes.
Please note that a prefix will be added to the user as well. Take a note of the username.
We need to add user to the database as the last step. Choose the newly created user and database for OpenCart, and then click the Add button.
In this step, we are going to assign privileges for the user in the database. Select the All Privileges option, and then press the Make Changes button to give all the privileges to the user.
Providing all MySQL privileges to a user can be dangerous on a production site. Optionally, you can remove unnecessary permissions such as create, drop, and alter tables after installation is complete. Also note that some plugins which we can later install can require create, and alter permissions.
Depending on our knowledge and experience on MySQL permissions, we are free to choose an advanced or simplified privileges management.
The following screenshot shows the result page after clicking the Make Changes button:
We have seen how to prepare a database for OpenCart. The steps include:
Choosing a name for the database.
Choosing a username and providing a secure password.
Adding user to the database.
Adding privileges to user for the database.
Now we are ready to continue our installation by using OpenCart Installation Wizard.
Let's browse the domain name where we put OpenCart files. In our example, it is http://yourwebsite.com/store. You should use your own OpenCart path. We will be redirected to a License screen automatically. Click Continue to start.
OpenCart will control several installation requirements, including PHP settings and extensions.
If the system check finds any serious error, it will stop the installation temporarily and will not let us go further until we solve the problem. If it is the case, please check the requirements list section and file permission settings again carefully. If there is a need to make changes on the PHP settings and extension, please contact your hosting provider.
In this step, we will supply the database connection information to OpenCart system. First, we should provide the previously created MySQL user and password for User and Password fields. Then, fill the MySQL database name in the Database Name field.
Finally, we should choose a Username, Password, and Email to be used to log in and manage the OpenCart system.
Let's ignore the Database Prefix option.
If we are allowed to create only one MySQL database for all applications being installed on hosting, it is a good idea to use Database Prefix option. It would put the shortened text in front of table names which will help us in differentiating tables in each application.
ocwould be a good prefix example. So, the tables would look like
Even though the following screen has informed us that we have finished, we actually have not!
For security purposes, we must delete the installation directory. Then, we should check the online storefront and administration screens to be sure that everything is working in the default settings.
Let's browse to http://yourwebsite.com/store, the online shop storefront. We can see a pre-populated sample store that is similar to the following screenshot:
Let's browse to the OpenCart administration screen at http://yourwebsite.com/store/admin and log in by using our admin username and password.
We will see an administration screen similar to the following screenshot:
Congratulations! Our OpenCart installation is now complete.
We have completed the installation using OpenCart wizard. The steps included the approval of license agreement, system checks (php settings, file permissions), providing database connection information, and deleting the install folder after completion of install. Finally, there are checking the storefront and administration screens.
We have now a sample running OpenCart system.
Now, it is time for testing your skills on installing another instance of OpenCart at thehttp://yourwebsite.com/teststore folder. Later, will only be able to use this instance for testing purposes before applying some new things on the original store which we have together completed installing. Try to do the steps on your own without looking at the chapter sections at first. If difficulties occur, re-read the required chapter sections.
As you see, OpenCart installation is very straightforward. The most important thing is to be sure that your hosting environment runs on an Apache server with (Linux or Windows) and PHP 5.0+ and MySQL is supported. If we want to SEO-enable our system, let's be sure that
mod_rewrite extension for Apache and permission to change
.htaccess file is allowed.
In this chapter, we learned how to install OpenCart on a web server.
Specifically, we covered:
Downloading and uploading files
Creating MySQL database and user
Using Installation Wizard
Deleting install directory after the completion of installation
Checking storefront and administration screens
We are ready to explore OpenCart categories and products and their options on the next chapter.