Want to install OpenCart on your new hosting? Well, OpenCart Hostinger installation is easy and it will hardly take a few minutes.
This is a step-by-step guide on how to install OpenCart on the Hostinger server. The guide will take you through 3 different methods to install the CMS and run your store.
Letās dive in.
How to install Opencart on Hostinger? (3 Methods)
We will see three methods to install OpenCart on Hostinger. The three methods are used for different scenarios. The first two methods are for web hosting whereas the last method is to install OpenCart on Hostinger VPS.
Method 1: 1-Click Install
The easiest way to install OpenCart is using a 1-click installer inside hPanel.
Step 1: Head over to auto-installer on hPanel
Firstly, you can open your hPanel and move to Websites > Auto Installer.
Step 2: Select OpenCart
Now, you will see a bunch of options for CMS. You can scroll a bit and search for OpenCart from the drop-down.
Step 3: Enter OpenCart Configuration details
Fill in the details and hit the next button to complete the installation. You can also set advanced options if needed. We do recommend opening the advanced options and taking a look at them.
This will give you a rough idea about the advanced options. The advanced options are usually about database names, table prefixes, etc. You can surely change those options if you want.
A bit of technical know-how is needed to tinker with such configuration.
Thatās it. Yes, it was that easy to install OpenCart on Hostinger using their hPanel.
Method 2: Manual Installation
Installing OpenCart manually takes a bit more time than usual. Some people prefer it when there are some issues with the auto-installer.
Step 1: Create a database
There are some sub-steps involved and the first of them is the creation of a database. So, we will cover all these steps here.
Inside your hPanel, you will have to head over to Databases -> MySQL Database Wizard.
Name your database. Now, it will ask you to create a username and password. You can enter your preferred details.
Lastly, you will have to give permission to the user for the current database. There are many options. You can simply select all the permissions and youāre good to go.
Step 2: Download OpenCart
Open the official website of OpenCart and download the files. There are two options to download. You will have to go to the free download option.
It will then download the files for self-hosted OpenCart.
Step 3: Upload the files
There are multiple ways to upload your files to Hostinger. We prefer File Manager as itās easy and fast. You can also do it with FTP.
To upload files, you can head over to Files > File Manager.
Now, open the directory of your domain. If itās your main domain, the files should be placed inside the public_html folder.
Open the folder and click on the upload icon on the top-right corner to upload the zip file you downloaded in the previous step.
Upload the files and then extract them (right-click on the zip and select extract).
Please note that you can do the same process with FTP. However, FTP takes a lot of time and it can become complex for beginners.
You can surely learn about FTP in the future as itās a great way to upload files.
Step 4: Configuration for OpenCart in Hostinger
Now, you can configure OpenCart.
Open the public_html directory where you added the files. Head over to the upload folder and you will see a file named config-dist.php. Change the file name to config.php.
You will find a file with the same name in the admin folder. Do the same procedure there.
Now, itās time to run the installer.
Step 5: Run the Installer
Open a new tab and head over to the following URL: Example.com/install. Here, example.com is your domain name. You will see a few steps.
- Read the agreement and hit the accept button.
- In the next step, you will have some pre-installation options. Keep everything as it is and hit the next button.
- In the 3rd step, you will have to enter all the details which you created earlier. It will have a database name, password, port name, etc. You will find all these details on your hosting account. If not, you can contact the support to get these details.
Once done, you can click on continue and your OpenCart Hostinger installation will start. It will take a few minutes to install it. You can then log in using the ID/pass you set earlier.
We will now delete the āInstallā folder by heading over to the file manager and deleting the entire āInstallā directory. Even OpenCart will ask you to delete the directory. Itās for security purposes.
Method 3: Install OpenCart on VPS
Now comes the method to install OpenCart on Hostinger VPS.
Step 1: Accessing your VPS
Log in to your VPS and head over to your preferred VPS plan. You can do it by going to the Hosting section and clicking on manage.
Access the VPS plan you want. You can do it using SSH or their panel.
Step 2: Update the System
If you are using a panel, you can open the terminal and enter the following commands. These commands are case sensitive so make sure you type them in lower case.
sudo apt update
sudo apt upgrade
Step 3: Install Required Dependencies
OpenCart requires a web server installed on the VPS along with PHP and a database server. Hereās the command to install all these.
sudo apt install apache2 php mysql-server php-mysql libapache2-mod-php
Step 4: Create a MySQL Database
Now, we will start with creating a new MySQL database and a user for that database. Enter the following command and enter the root password.
mysql -u root -p
We will now create a database. Donāt forget to put the semicolon at the end of the commands.
CREATE DATABASE opencart_db;
The next step is to create a user by entering the following command. Make sure you change username, localhost by your domain name, and password by your password.
CREATE USER āopencart_userā@ālocalhostā IDENTIFIED BY āyour_passwordā;
Itās time to grant all the permissions. Again, make sure to replace the username.
GRANT ALL PRIVILEGES ON opencart_db.* TO āopencart_userā@ālocalhostā;
Now, we will reload all the tables. For that, we will use the flush command.
FLUSH PRIVILEGES;
Finally, Itās time for the exit command.
EXIT;
Step 5: Download OpenCart
You can head over to the official website of OpenCart and download the zip. After downloading, you need to upload this zip file to your VPS using SFTP or SCP.
Once you upload it, you can extract it to the root directory usually at `/var/www/html/`. Hereās the command to unzip the file.
sudo unzip opencart-x.x.x.x.zip -d /var/www/html/
After you unzip it, you will have to change the config file names. There are two files that you will have to rename. Both of them are named config-dist.php which we will have to change to config.php.
One of the files is in the upload folder whereas the other one is in the admin folder.
You can either do it manually if you are using a VPS panel. However, most people tend to use the terminal for Hostinger VPS for utilizing OpenCart.
So, here are 2 commands you can execute for renaming the files.
cp /var/www/config-dist.php /var/www/config.php
cp /var/www/admin/config-dist.php /var/www/admin/config.php
Step 6: Set Permissions
We will quickly check and set permissions.
For that, we will first head over to the web root directory with the cd command.
cd /var/www/html/
We will now set the permissions. The following commands are used to change ownership and permissions of files and folders.
sudo chown -R www-data:www-data *
sudo chmod -R 755 *
Step 7: Configure Apache
As we mentioned before, you will need a web server to run OpenCart. So, we will here configure the virtual host to install OpenCart on Hostinger VPS.
sudo nano /etc/apache2/sites-available/opencart.conf
While we are on it, you can also do the configuration. Open the config file using the following command.
sudo nano /etc/apache2/sites-available/000-default.conf
You can use any text editor (nano, vi, vim etc) to open it. Enter the following lines of code.
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName your_domain.com
DocumentRoot /var/www/html/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Now, you can simply enable the new host we configured before restarting Apache.
sudo a2ensite opencart.conf
To restart apache server, either of these commands can be used.
sudo service apache2 restart
OR
sudo systemctl restart apache2
Step 8: OpenCart Installation
Simply visit the domain name or you can open the IP address for your Hostinger VPS for OpenCart.
Just follow the instructions and the installation is completed. Itās pretty self-explanatory.
- The first step is the license agreement.
- You will then have a pre-installed requirement. Keep everything as it is.
- Enter database details for OpenCart.
- Complete the installation
If you face any issues, you can refer to step 5 of our manual installation process.
Step 9: Secure your Installation
You can now remove the installation folder for security reasons. Enter the following command to do it.
sudo rm -rf /var/www/html/install/
Step 10: Complete Setup
Once you have done all the steps above, you are done with the installation. You can open the admin panel and start customizing your OpenCart.
You can use example.com/admin to log in to your OpenCart.
What are the hosting requirements for OpenCart Hostinger?
OpenCart can run on most of the hosting accounts without any special requirements. If you have a hosting account, you are good to go. So, you donāt need to worry about any minimum amount of RAM.
You will need at least 90 MB of storage.
Here are a few requirements you will need to run OpenCart.
- A web server (Apache or Nginx)
- PHP version 7.2 or higher is preferred
- For database, MySQL version 5.6 or higher
Any alternative to these will also work. For instance, OpenCart supports MySQLi and PDO APIs (or DB drivers) for making secure MySQL database calls.
OpenCart supports Postgres databases too.
All the plans of Hostinger support OpenCart.
Conclusion
You can use any of these methods to install OpenCart on the Hostinger server. For shared hosting, we prefer a one-click installer rather than a manual installation.
For VPS, you will have to do the steps to install OpenCart in Hostinger.
So, how was your experience in installing OpenCart? Did you face any issues in completing the steps? Let us know in the comment section below.
FAQ (Frequently Asked Questions)
What database does OpenCart use?
OpenCart uses a MySQL database.
What programming language does OpenCart use?
OpenCart uses the PHP programming language.
Is OpenCart free or paid?
OpenCart is free if you have your own hosting. However, their OpenCart cloud is not free.
Web Hosting Expert, Content Writer, SEO Consultant, and Web Developer with over 10 Years of Experience.
He has a passion for technology and has spent over a decade reviewing and testing web hosting companies to provide his readers with honest and accurate reviews of the companies he had experiences with.
Tommy loves helping people and has helped hundreds of people start their own successful blogs.