osCommerce Installation and Initial Setup

This tutorial will tae us through the process of installing OsCommerce. Let's get started right away.

 

OsCommerce Manual Installation

To manually install osCommerce, you will first need to download the latest version of osCommerce from the osCommerce official website. Once you download the files you should have a zip file called osCommerce-x.x.x.zip. Now that you have the files, follow the steps below to get the osCommerce installed on your server.

Also read: osCommerce Security Tutorial

 

Steps to manually install osCommerceLogin into your cPanel.

  • Go to the File Manager. Select and double-click on the directory for your osCommerce installation.
  • Extract teh files for osCommerce file to your server and Extract the .zip file. Note! Make sure the files are in the directory and not a subfolder. If you see the files in a "Catalog" subfolder, move them into the main folder for the domain.
  • Create your database and database username.
  • Add the database user to the database and give the user all permissions. Important! Save your database name, username, and password. You will need it on step 8 below.
  • Visit the URL for your osCommerce.
  • Now you will see the "New Installation" page.
  • Click Continue.
  • Configure database connection. Enter your database name, username, and password. Leave the Database server localhost.
  • Click Continue.
  • Next is the Web Server information. You can change the url or leave as is. Leave the settings as is.
  • Click Continue.
  • Fill in your Online Store Settings. Make sure the email address is a valid one and click Continue.


    Congratulations! The installation is finished. Click the Catalog link.

Also read: osCommerce Configuration Tutorial

Next Steps After a Successful Installation

Secure Your osCommerce Website

osCommerce websites are essensially e-commerce websites and that underscores the need to effectively secure the site just as it is to secure every other website . This articletakes you through the basic process to secure the your osCommerce website.

We cover three(3) critical areas in osCommerce security:

1. How to secure the configure.php file.
2. Securing with htaccess/htpasswd.
3. Add Captcha to your contact form

Let us begin with securing the configure.php file.

After installing osCommerce you will see a message similar to "I am able to write to the configuration file: /home/usertod1/public_html/includes/configure.php. This is a potential security risk in osCommerce and so the first thing to do is to set the user permission on this file.

In this tutorial you will learn how to modify the permissions of the configure.php file, so it is secured and the notification will go away.

Securing the configure.php File:

    Login to your cPanel.
    Under the File section, click the File Manager. If the File Manager Directory Selection window comes up, click Web Root, and click the Go Button.
    Navigate to the configure.php file specified in the error. In my tests it is: /home/usertod1/public_html/includes/configure.php
    Right-click the configure.php file, and click Change Permissions.
    In the change permissions window, change them to 4-4-4, then click the Change Permissions button.
    Now login to the osCommerce Admin section, and you will notice that the "Security risk" message is gone, and has been replaced by "This is a properly configured installation of osCommerce Online Merchant!"

That's it.

Securing with htaccess/htpasswd

When you first login to your osCommerce administratorsection in adminarea, you will see the message: "This osCommerce Online Merchant Administration Tool installation is not additionally secured through htaccess/htpasswd. It means, enabling the htaccess/htpasswd security layer will automatically store administrator username and passwords in a htpasswd file when updating administrator password records." To fix this securty problem, you will need to follow the steps below:

Login to the Admin Panel for osCommerce.
    Click the Administrators link.
    You will see the users listed toward the bottom. Click the Edit button to the right of your administrator.
    Enter a password in the New Password field, check the box for Protect With htaccess/htpasswd, then click the Save button.
    A box will pop up asking for a username and password, enter the ones you just set, and click the OK button.
    Instead of the red warning message, you will now see a green message stating "This osCommerce Online Merchant Administration Tool installation is additionally secured through htaccess/htpasswd means."

How to Add Captcha to your contact form using simple Captcha Addon

osCommerce comes with a contact form by default. This form has no validation to prevent robots from filling the form. You can solve this problem with the Simple Captcha Addon. Here are the proceedure:

1. Download the captcha module

Download captcha plugin osCommerceBefore you can set up the captcha on your contact form, you will need to download the files from the osCommerce Add-On site.

Once you get the osC-2.3.1-simple-captcha-1.2.zip file on your computer, follow the steps below.


    Upload the files in the catalog folder to your osCommerce installation directory.
    Upload the example-osimg.jpg image file to your images directory in your osCommerce installation folder.
    Rename the image to captcha.jpg.
    Create a folder in your osCommerce installation folder and call it "fonts".
    Upload your font to the font directory for the captcha to work. In this tutorial we are using the Aerovias Brasil font available here.
    Edit the following file.

    /includes/functions/validations.php


    Add the captcha code to the file osCommercePaste the following code into the validations.php file before the ?> at the bottom of the page.

    define('CAPTCHA_FONT', DIR_FS_CATALOG . 'fonts/truetypefont.ttf');
    define('CAPTCHA_LOAD', 'images/captcha.jpg');
    define('CAPTCHA_IMAGE', DIR_FS_CATALOG . CAPTCHA_LOAD);

    Note! You will need a font uploaded. Make sure you change the truetypefont.ttf file name to your font file name. In this case the path will be AeroviasBrasil.ttf.

    Save the changes.

    Now revisit your website where the contact form is and you will see the captcha on the page.

 

How to Enable SSL on an Existing osCommerce Installation

 
One that is already running an osCommerce website. This could be because you installed osCommerce and did not enable SSL and you now want to do that to improve public confidence in your website. Now, to do this, you need to bear in mind that OsCommerce and other PHP, ASP, or JSP carts will not run on the shared server cert. You will need a private cert or to switch to a cgi based cart like Agora.


Now, let's go to the proceedure to turn on SSL on in OsCommerce if you didn't set it up when installing.

You will edit the following (two) files: /includes/configure.php and /admin/includes/configure.php as follows:


define('HTTP_SERVER', 'http://www.yourdomain.com'); // eg, http://localhost - should not be empty for productive servers

define('HTTPS_SERVER', 'https://www.yourdomain.com'); // eg, https://localhost - should not be empty for productive servers

define('ENABLE_SSL', true); // secure webserver for checkout procedure?
define('HTTP_COOKIE_DOMAIN', 'http://www.yourdomain.com');
define('HTTPS_COOKIE_DOMAIN', 'https://www.yourdomain.com');
define('HTTP_COOKIE_PATH', '/catalog');
define('HTTPS_COOKIE_PATH', '/catalog');

Please you will need to change "yourdomain.com" to the exact domain name used for the SSL cert. If you did not use www for the cert, then do not add it there either. Change 'ENABLE_SSL' to true and 'HTTPS_COOKIE_PATH', if necessary, to the store's main folder.

If you have followed these instructions carefully, you have enabled SSL on your osCommerce installation.


Login password fix in osCommerce.

Here is the easiest way to reset the password for most people.

    Login to cPanel and click the phpMyAdmin icon. (In the X theme, you must click the MySQL Databases icon and scroll to the very bottom to find the phpMyAdmin link.)

    Look in the blue, left hand menu for your osCommerce database name (typically _osc1). Click the name.

    Again, look in the blue, left hand menu and click the table named administrators.

    Look in the white, main area at the top for a tab called Empty. Click it.

    You will be asked, "Do you really want to : TRUNCATE TABLE 'administrators' ?" Click OK.

    Now return to your osCommerce site and try to login to the admin area. The site will say that there is no user, so you can be the first.

    Enter the desired admin name and password into the login area and click the Login button.

    Nothing will seem to happen, but your site just accepted your submission as the new admin login. So, try to login with the same admin name and password you just typed in the previous step.

 

Boost The Performance of Your osCommerce Website wit the Cache System

Whenever your cache directory is not setup for your store you will get a pink error
message at the top of the store screen like this:

Error: Cache directory does not exist. Please set this Configuration->Cache.

Sometimes, you will not set your cache properly and you will also not receive the above error if your Configuration/Cache was set to false by default.
Defaults of the osCommerce Cache


Default Cache Configuration in osCommerce

In the admin under Tools/Cache Control the listings are as follows:


The default for the Cache Directory is /tmp/

The osCommerce documentation advises to create a sub-folder named “cache” in the main folder (catalog).

Right-click on the cache sub-folder and then click Properties.


Make Cache Directory


Set chmod permissions to 777.


Then go to Configuration/Cache. Click on “Use
Cache” and set to “true”.


Click on Cache Directory and set the absolute directory path to the “cache” folder

Click the edit button once you click and highlight the Cache Directory.


You need to enter your absolute path (as opposed to the relative path. So go to Tools. The Database Backup Manager should display. You’ll see the Backup Directory. So the absolute path looks something like:


 /home/username/public_html/domainname/catalog/cache/


Click the update button.

The osCommerce documentation warns to remember about case sensitivity so just simply copy and paste the absolute path from the Tools/Database Back Manager.


file does not exist error: osCommerce cache

If the “file does not exist” messages still exist, upload via FTP, three blank files into your cache directory called:

categories_box-english.cache
manufacturers_box-english.cache
also_purchased-english.cache


Once you create those files and upload them you’ll see things working fine. Just remember to create the filenames as above and do not place any text within the files.


The osCommerce docs states:

If there are more languages, create more files replacing engish with language name and upload.

 

Caching with a Module

You can enable cache on your osCommerce website by implementing a module. Some of the modules are free while others require payment to download. Here we document one of the fine modules recommended for osCommerce caching: The MagneticOne osCommerce performance module.

osCommerce Performance module greatly increases performance of your osCommerce-based store.

How much speed do you get - some examples:

    Large store with 12 000 products and 1279 categories
    Before performance optimization: 4.33 sec
    After performance optimization: 0.64 sec
    676 increase
    Medium-size store with 800 products and 23 categories
    Before performance optimization: 2.23 sec
    After performance optimization: 0.41 sec
    212.38 increase


osCommerce Performance module features:

    Greatly increases performance
    Greatly reduces server load
    Supports unlimited number of products /categories (supports large stores)
    Very easy installation, 5 cut&paste steps necessary - start using in 5 minutes!
    Enable/Disable with few mouse clicks
    Completely automated - no additional support/management necessary
    No complicated code changes necessary (do it quickly - save time)
    Multiple configuration options(while everything working by default)
    Predefined optimal Cache Time (how long page is cached) - 3 hours
    Preset Cache Folder (detected automatically when available)
    Predefined maximum Cache Folder Size (to prevent disk space problems) - 100Mb
    Optional Client Optimization option (to prevent disk space problems)
    and other


Recently added advanced features:

    CSS / JS files merging
    Unobtrusive JS and dynamic loading
    HTML minify
    CSS Tidy for CSS
    JSMin / Packer
    GZIP for textual files
    Optimized .htaccess for Apache
    Client side caching for static files
    Server side caching for minified CSS / JS / HTML files
    CSS Sprites
    data:URI ( IE7- hacks)
    Image optimization
    it just works!

How osCommerce speed up module works:

It implements a smart way of caching - storing and reusing parts of the page that take much time to load/generate.
It gives a much higher speedup than standard shopping carts caching due to the smarter approach.

First time when the page is accessed - it is generated as normal (no speed gain), when the page is accessed second time - it is taken from cache.


How to login to the osCommerce admin dashboard

To administer your osCommerce website, add new products, delete existing products, add modules and perform other functions, you will need to know how to log into the administrative dashboard. This tutorial will take you through the process to achieve that.

    Visit your Admin URL. Your admin URL for osCommerce is accessed by simply adding /admin to the end of the default web address. In our example below, you can see our default domain name is http://oscommerce.todhost.com To access the admin area, we type in http://oscommerce.todhost.com/admin

    You will be brought to a login screen. Here you will need to enter your administrative user name and password in the Username and Password fields, respectively.

    Once you have entered the proper username and password, click the Login button. This will bring you to the default admin control panel for your osCommerce site.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

osCommerce Security Tutorial

osCommerce websites are essentially e-commerce websites and that underscores the need to...

osCommerce Web Hosting

Todhost web hosting comes with free osCommerce that can be installed with few clicks. You can...

osCommerce Configuration Tutorial

After a successful installation of your osCommerce ecommerce website, you now need to set it up...

Content Management System in osCommerce

In this tutorial, we look at how to manage the content of your osCommerce store. After a...

Powered by WHMCompleteSolution