====== Installing osCommerce on Gandi AI ====== osCommerce is a very complete application which allows you to set up an online store on your website. ===== Creating a dedicated database for osCommerce ===== It's wise to have a database dedicated to your store. Let's go crazy, and call it "**store**". If you don't (yet) know how to go about this, please read this [[en:hosting:gandi-ai:create-database|tutorial]]. ===== Creating a directory for osCommerce ===== You have a choice here. For "neatness'" sake, such applications are generally placed in a folder within the **www** sub-domain (%%www.example.com/store%%) or in a specific sub-domain of its own (store.example.com). ==== If you prefer to have your store in a folder ==== Easy! Just make sure the you create a specific folder for the store (as in %%www.example.com/store%%) ==== If you prefer to have a sub-domain specifically dedicated to your store, such as store.example.com ==== Two things to do: *Configure your server for this sub-domain, as explained in this [[en:hosting:gandi-ai:configure-virtualhosts|tutorial]]. *Configure your sub-domain to point to the server you have just configured, as explained in this [[en:hosting:manage-quota:attach-domain|tutorial]]. This is the option we will be using in the rest of the tutorial. ===== Uploading osCommerce ===== We now need to download it. At the time of writing, the latest version was called MS2.2. Nothing beats the official site to get the original compressed file. We therefore recommend [[http://www.oscommerce.com/redirect.php/go,43|this link]]. Once you've downloaded the file onto your favorite hard drive, unzip it. You now have a folder (let's rename it **store**) containing all of the osCommerce files. Launch your favorite FTP client (we recommend [[http://filezilla-project.org/|FileZilla]]) and log in as **admin** onto your server. Then, open the folder corresponding to the path you had originally defined (for more help regarding uploading files onto your server, please read [[en:hosting:gandi-ai:ftp-upload|this tutorial]]). In our example, the path of our FTP would therefore be: /srv/d_ma-gandi-ai/www/store.example.com/htdocs ... that is, unless you've changed the initial configuration of the web files. If that's the case, however, I'm assuming you knew what you were doing :) At this stage, we can now upload the store files onto our server. *If you have created a **store.example.com** sub-domain, you will want the store to come up as its front page, and you should therefore **upload the content** of the **store** folder (as opposed to the folder itself) within the **htdocs** folder of your sub-domain. *If you're not a fan of sub-domains and prefer a good old **example.com/store**, then you need to **upload the complete folder** into **htdocs**. ===== Preparing the osCommerce files ===== For osCommerce to configure properly, certain files will need specific rights. In most cases, to change these rights with your FTP client, all you need to do is righ-click on the file concerned and chose the right term in the menu (could be Rights, CHMOD, Properties). Supposing you were using FileZilla (but any FTP client would be very similar): Right-click the concerned file and select **"File Attributes..."**. The window that has just opened gives you two different methods to change the file rights: boxes to tick and numeric values. The point of the tutorial not being to explain the numeric values of rights in UNIX, let's just say you can simply **replace the numeric value by 777**. The files which will need their rights changed are: catalog/includes/configure.php catalog/admin/includes/configure.php ===== Adapting your server configuration ===== The following may sound a little daunting, but it is in fact quite straightforward if you follow the instructions. For osCommerce to work on your server, you will indeed need to do the following: * Create a new notepad (plain text) file on your computer. * Type in the following line: php_flag register_globals on * Save the file and name it **.htaccess** (don't forget the "**.**" at the beginning, and please note that this file **has no extension** at the end). * Upload it into the **htdocs** folder of the sub-domain hosting your osCommerce folder. In our case, this would therefore be: /srv/d_ma-gandi-ai/www/store.example.com/htdocs If you are a Windows user, you will notice that Windows will not allow you to name the file **.htaccess** because it will read the "**.**" as the beginning of an extension (such as .doc, .txt, .gif...). You're better off uploading the file onto your server with any name (as long as the content is OK), and then rename the file as "**.htaccess**" by right-clicking the file and renaming it in your FTP client. ===== Installing osCommerce ===== Your store is ready to be installed and configured! Open your web browser and open the **/catalog** folder which corresponds to your forum's path. Still following our initial example, this would be: store.example.com/catalog Welcome to the first page of your store setup. You should fill in the following fields as indicated: * **Database server:** type localhost * **User name:** Choose a user name for the store administrator. * **Password:** ... and his or her password. * **Database name:** At the beginning of the tutorial, we called ours **store**. * **Persistent connections:** Leave this value unticked. * **Session storage:** osCommerce recommends that you tick the Database option ---- Now you're set for the next page. All of the fields will be filled in by osCommerce, and will have default values generated according to osCommerce's location. As such, you are better off leaving the following values unchanged: * **www address** * **Webserver root directory** * **HTTP cookie domain** * **HTTP cookie path** * Also, you may chose to Enable SSL Connections at this stage ---- Go to the next page: osCommerce will then re-confirm the info related to your database configuration. Passed this step, you're done! ...well, almost. Don't forget to delete the **/installation** folder, and to change back the rights from **777** to **644** for the following files: catalog/includes/configure.php catalog/admin/includes/configure.php Congratulations on your new store! For any further information, please consult the [[http://www.oscommerce.com/solutions/documentation|osCommerce official documentation]] and [[http://forums.oscommerce.com/|support]].