How to install X-Cart 5 on CentOS

xcart vpsX-Cart is a search engine friendly shopping cart software written in PHP with many features like: WYSIWYG editor, easy-to-use web interface, order tracking, customer order history, real time shipping calculation, printable invoices and receipts, built-in marketing tools like up-selling, cross-selling, discounts and more.

This install guide assumes that Apache, MySQL and PHP are already installed and configured on your Linux VPS. At the time of writing this tutorial, the latest stable version of X-Cart is 5.2.13 and it requires:

  • PHP 5.3.10 or higher with the following PHP extensions enabled: libCURL, PDO, Phar and GD Graphics Library version 2.0.x+ (or ImageMagick). Also, safe_mode and magic_quotes_runtime settings should be disabled and ini_set and file_uploads setting should be enabled in PHP configuration (php.ini).
  • Apache Web Server 2.0 or higher compiled with mod_rewrite module and with the following directives allowed: RewriteEngine, RewriteBase, RewriteCond and RewriteRule.
  • MySQL 5.1.31 or higher, or MariaDB database server installed on your virtual server.

This tutorial was tested and written for a CentOS VPS, but it should work on any server using some RPM based Linux distribution.

Installation instructions

Download the latest version of X-Cart available on the official website at ‘http://www.x-cart.com/download.html’ to a directory on your server, then extract the archive file using the following commands:

cd /opt/
wget http://static.x-cart.com/xc5kit/x-cart-5.2.13-en.zip -O x-cart.zip
mkdir -p /var/www/html/xcart
unzip x-cart.zip -d /var/www/

Run the following command to set proper permissions:

chown apache:apache -R /var/www/xcart/

Create a new MySQL database for X-Cart 5 on your server:

mysql -u root -p
mysql> CREATE DATABASE xcartdb;
mysql> GRANT ALL PRIVILEGES ON xcartdb.* TO 'xcartuser'@'localhost' IDENTIFIED BY 'your-password' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
mysql> quit

Locate the php configuration file using the following command:

#php -i | grep php.ini
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /etc/php.ini

Edit the ‘php.ini’ file and add/modify the following lines:

file_uploads = On
allow_url_fopen = On
memory_limit = 256M upload_max_filesize = 10M post_max_size = 20M safe_mode = Off magic_quotes_runtime = Off session.auto_start = 0

Create a new virtual host directive in Apache. For example, edit your Apache configuration file (‘/etc/httpd/conf/httpd.conf’ by default) and uncomment the following line:

Need a fast and easy fix?
✔ Unlimited Managed Support
✔ Supports Your Software
✔ 2 CPU Cores
✔ 2 GB RAM
✔ 50 GB PCIe4 NVMe Disk
✔ 1854 GeekBench Score
✔ Unmetered Data Transfer
NVME 2 VPS

Now just $43 .99
/mo

GET YOUR VPS
#NameVirtualHost *:80

Then, add the following lines at the end:

<VirtualHost *:80>
ServerAdmin admin@your-domain.com
DocumentRoot /var/www/html/xcart/
ServerName your-domain.com
ServerAlias www.your-domain.com
<Directory /var/www/html/xcart/>
    Options FollowSymLinks
    AllowOverride All
</Directory>
    ErrorLog logs/your-domain.com-error_log
    CustomLog logs/your-domain.com-access_log common
</VirtualHost>

Restart the Apache web server for the changes to take effect:

service httpd restart

Set the following secure file permissions:

chmod 755 /var/www/html/xcart/
chmod 755 /var/www/html/xcart/etc/
chmod 644 /var/www/html/xcart/etc/config.php
chmod 644 /var/www/html/xcart/.htaccess

Open http://your-domain.com in your favorite web browser and follow the easy instructions; set an email address and password for accessing the administrator back-end of your e-commerce website, enter the MySQL database name, username and MySQL password and click ‘Next’.

That is it. The X-Cart 5 installation is now complete. Log in to the X-Cart administration back-end at http://your-domain.com/admin.php , configure X-Cart according to your needs, add new features and/or disable existing ones, then add products and start creating your e-commerce website.

xcart back-end


Of course you don’t have to do any of this if you use one of our CentOS Optimized VPS Hosting services, in which case you can simply ask our expert Linux admins to install X-Cart 5 for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Leave a Comment