Write Review

How to Install X-Cart On Ubuntu 18

X-Cart is a widely used open source cart that runs on PHP. X-Cart has been in use for over 17 years and is one of the pioneers in E-commerce solutions. X-Cart is an excellent value in cart solutions as there is just a one-time licensing fee with no ongoing costs past payments to the payment processor and web hosting.

Feature-wise there are few downsides of X-Cart compared to its competition as its been in the market for some time and it has many of the same great integrations and capabilities as its more well-known competition. While it may not have the market penetration that Shopify or Magento does, it's a great shopping cart solution for your online store. We’re going to go over how to install the free edition on your server to get started:

  1. Add Your Domain to Your Hosts File

$ sudo nano /etc/hosts

Add the following to the bottom of the file, then save and close it:

  1. Set the Hostname on the System

$ sudo hostnamectl set-hostname yourdomain.com
  1. Install tasksel if Needed

$ sudo apt-get install tasksel
  1. Update Your Current Packages and Reboot

# apt-get update && sudo apt-get upgrade
  1. Install LAMP

$ sudo tasksel

Select only LAMP off the next screen and continue. The LAMP stack will get installed.

How to Install X-Cart On Ubuntu 18

  1. Install the Required PHP Modules

$ sudo apt-get install php-mbstring php-curl php-gd php-xml
  1. Update the PHP ini File

$ sudo nano /etc/php/7.2/apache2/php.ini

Update the following variables in the file. Make sure to set the date.timezone entry to the correct entry for your location per the PHP timezones page.

file_uploads = On
allow_url_fopen = On
memory_limit = 128 M
upload_max_file_size = 64M
date.timezone = Europe/Bucharest

  1. Restart Apache

$ sudo systemctl restart apache2
  1. Create a MySQL Database and User

$ sudo mysql -u root -p
> create database xcartdb;
> grant all privileges on xcartdb.* to 'username'@'localhost' identified by 'passwordhere';
> flush privleges;
> exit
  1. Download X-Cart and Copy it to a Temporary Directory Then Extract the Archive

$ sudo scp x-cart- sudousername@yourserverip:/tmp
$ sudo tar -xzpf x-cart-
  1.  Copy the Newly Created X-Cart Directory to the Web Server Root Path

$ sudo cp -rf xcart/* /var/www/html/
$ sudo cp xcart/.htaccess /var/www/html/
  1.  Make Sure All Files on the Webroot Path are Owned by Apache and Rename the Old Index File

$ chown -R www-data:www-data /var/www/html/
$ sudo mv /var/www/html/index.html /var/www/html/index.old
  1. Browse to Your Domain and Follow the on Screen Prompt to Begin the Installation

How to Install X-Cart On Ubuntu 18

  1.  Follow the On Screen Prompts to Setup Your Administrator Account

    How to Install X-Cart On Ubuntu 18

  2.  Enter the Database Information From Step 9 Above

    How to Install X-Cart On Ubuntu 18

  1.  Installation is Now Completed. There Are a Few More File Permissions to Set.

How to Install X-Cart On Ubuntu 18

Set the final file permissions:

$ sudo chmod 755 /var/www/html/
$ sudo chmod 755 /var/www/html/etc/
$ sudo chmod 644 /var/www/html/etc/config.php

If you see a warning about the MySQL query cache not being enabled you can enable it by editing your MySQL conf.d file and updating the query_cache_type variable:

$ sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
Find the existing query_cache_type variable and update it or add the following to the file:
query_cache_type = 1

Its Installed!

X-Cart is now installed and ready for use. Yourdomain.com/cart.php should pull up the customer facing site. I’ve installed the sample store that comes with X-Cart.

How to Install X-Cart On Ubuntu 18

The admin side of the store can be by going to yourdomain.com/admin.php. From here you can login and add products, setup your payment methods, and get your store up and running!

How to Install X-Cart On Ubuntu 18

Check out these top 3 Ecommerce hosting services:

Was this article helpful?