PDA

View Full Version : HOW TO: Install OSCommerce on Ensim



Joe
11-16-2002, 03:59 PM
Requires SSH access:

Courtesy of: http://secure.xprowler.com/oscomm.html

How to Install OSCommerce on Ensim 3.0 and 3.1

Disclaimer
This Tutorial is based upon a Tutorial provided by Ric who frequents and makes lives a little bit easier in the Plesk section of the RS Forum. This Content has been modified to show you how to install OSCommerce on Ensim 3.0 and 3.1 servers by Mouse with specific written permission by Ric. Thanks is given and your work is greatly appreciated Ric as it wasnt all that hard for me to port this to Ensim.. Mouse

Some Warnings now!!

You should know that there is always the possibility that your system is not compatible for one reason or another or more likely, that you could make a mistake which could cause unforeseen problems on your box.

You need a basic working knowledge of Linux to apply these tutorials and if you are unsure of your personal capabilities in this area, think real hard about if you want to attempt this or not.

These tutorials are created and offered as is and to the best of my knowledge, this is correct and safe to use. I accept no responsibility for any problems created by following this however, use at your own risk.

Required Software
osCommerce has two sites and either will suffice for getting the software or jumping into their furum.

http://www.oscommerce.com

http://www.oscommerce.org

The software that we use in this tutorial can be obtained from the daily snapshot download page at the following URL...

http://www.oscommerce.com/downloads.php/snapshot

I Highly reccomend choosing the combined package for Unix in the upper right hand corner as it will get you all of the important files..

In this how to I will be Color Coding the sections of code in which you need to copy/paste or type in your SSH window

Commands to be typed or copy/pasted will be BOLD AND BLACK



Let's Do It!
This is using our domain, domain.com aka site25 as an example.

Again, this is for the daily snapshot version and not the stable, released version, they are very different. The stable release version is very basic and if you look through their forum you will see that most people are using the daily snapshot version. It contains all of the nice features of the script absent from the stable version but it is in devel so anyone using it needs to stay current with issues on their board.

1. Open your admin control panel in Ensim and create a MySQL database in the domain you are going to install the store on.

NOTE: If you don't have phpMyAdmin, use whatever method you use to create MySQL databases.

2. Create a database user with a password for that database and write all three down because you will need them during the install.

3. Change to the web root dir of the domain your going to install this on...


cd /home/virtual/site25/fst/var/www/html


4. Get the tar files for the store using wget...

wget http://tep.sourceforge.net/snapshots/tep_s...20020725.tar.gz (http://tep.sourceforge.net/snapshots/tep_snapshot-20020725.tar.gz)


NOTE: Those exact file names will change daily and I am just using them as an example for this how to. What you need to do is go to their daily snapshot download page and get the current names of the files.


5. Gunzip & Untar the files you just downloaded with the following commands...

tar zxvf tep_snapshot-20020725.tar.gz

5.5 Next we have to change the name of the admin folder so that it doesn't conflict with the Ensim default alias "admin"

mv admin /home/virtual/site25/fst/var/www/html/osadmin


5.5.1 Next we have to set the site to safemode off for PHP

cd /etc/httpd/conf/site25

pico -w safemode

php_admin_flag safe_mode off

CTRL + X

Y

service httpd restart 5.5.2 Next we set default.php as an allowed default document in /etc/httpd/conf/httpd.conf pico -w /etc/httpd/conf/httpd.conf

CTRL + W (to locate)

DirectoryIndex

Scroll to the end of the list and add default.php

CTRL + X

Y

service httpd restart


NOTE: This will create a dir structure from your web root that has html/catalog,html/osadmin &html/tep-docs. I initially made a "store" dir as a sub-dir of my html dir and installed it there instead because I thought it would be cleaner but it really made the install a mess... use the default dir structure as shown above if you don't want headaches!


6. Drop the URL to the install script into your browser, in this example, the URL is...


http://www.domain.com/catalog/catalog/inst...all/install.php (http://www.domain.com/catalog/catalog/install/install.php)

7. This brings up the install page and I will list the options and paths needed in my install...

* Import Catalog Database - Checked by default, leave checked
* Automatic Configuration - Checked by default, leave checked


* Webserver Root Directory - /home/virtual/site25/fst/var/www/html
IMPORTANT NOTE: On this option notice that they always tack on a /catalog at the end of that path by default and it has to be removed! This path should point to your web root dir like it implies.

* Webserver Catalog Directory - /catalog/catalog
* Webserver Administration Tool Directory - /osadmin/admin
* WWW Catalog Directory - /catalog/catalog/
* WWW Administration Tool Directory - /osadmin/admin/
* Database Server - xxx.xxx.xxx.xxx or localhost

NOTE: I used my IP here for the database server because this is an IP based domain but you can use a hostname on a name based domain if you like. The correct syntax if this was a name based domain would be your full domain name, in this case it would be fortweb.biz or possibly localhost or even localhost@fortweb.biz... I installed this once on a name based domain but I forget which spec was required, try each until you get a correct database connection.
* Username - This is the username you created for the database in step #1 & 2
* Password - This is the password you created for that username in step #1 & 2
* Database - This is the database name you created in step #1 & 2
NOTE: I know that their instructions (paths) on that page do not exactly sync with these settings. My guess is that the text has not been updated to reflect the correct paths.

8. Hit the "continue" button and it will test your database connection. If it can not make a connection then you need to go back and figure out where your error is, probably a typo on the DB, USER or PWD on the install screen or you did not correctly set the database up in step #1 & 2.

9. If the test is successful, hit the "continue" button to import the database. I got the error "Warning: Cannot set time limit in safe mode" but the database import was successful and you then select the "continue" button to go the next page.

10. I got an error on this page and had to do the following and then hit the "retry" button to continue. (It will list exactly what needs to be done on the error text)

cd /home/virtual/site25/fst/var/www/html/catalog/catalog/includes

touch configure.php

chmod 706 configure.php

cd /home/virtual/site25/fst/var/www/html/osadmin/admin/includes

touch configure.php

chmod 706 configure.php

NOTE: If you do not have shell access to the server, you can accomplish these permission changes via FTP. The "touch" command in shell will not be needed if you do this via FTP, in actuality, I am not sure why or even if it is needed in shell. Normally the touch command is just used to create a file that does not exist or to change file attributes, neither of which seems to apply here but I did as instructed by the script.
11. The next page lists all your configuration values which should be correct by default. Most of this stuff just re-iterates what you entered on the first install page as far as paths go but there are also some differences.

I don't have a cert on this domain so I left the "Enable SSL Connections" unchecked and at the bottom, I also left unchecked the "Enable Persistent Connections" box and the radio button that says "Store Sessions as Files"... I left all the defaults on this page as they came up and hit the "continue" button.

12. If everything went right, you should be looking at a screen that says "The configuration was successful!" and it offers you link buttons to both the catalog and the admin page.

13. When you go to the Catalog page (which is your storefront), you will see the following error at the top...



Warning: Installation directory exists at: /home/virtual/site25/fst/var/www/html/catalog/catalog/install. Please remove this directory for security reasons.

Warning: I am able to write to the configuration file: /home/virtual/site25/fst/var/www/html/catalog/catalog/includes/configure.php.

This is a potential security risk - please set the right user permissions on this file.

To correct this I followed their instructions and did the following...

cd /home/virtual/site25/fst/var/www/html/catalog/catalog/

rm -rf install

chmod 644 /home/virtual/site25/fst/var/www/html/catalog/catalog/includes/configure.php

Again, if you don't have shell access to the server you can accomplish these tasks in FTP. To do it in FTP you would delete the install dir at...

/html/catalog/catalog/install

Then you would change the permissions of the configure.php file in the following dir...

/html/catalog/catalog/includes/

Now refresh your Catalog screen and you should have a nice clean page with the demo store being shown. The database you imported is what this demo store is.
14. The last thing you need to do is password protect the admin dir because that is NOT built into the program. You can use Plesk or whatever admin scripts you run to do this if you like but I always just do it manually.

cd /home/virtual/site25/fst/var/www/html/osadmin
pico .htaccess

* this is the code for that file, change the domain/path to yours of course...

AuthUserFile /home/virtual/site25/fst/var/www/.htpasswd
AuthName "domain.com Cart Admin Access"
AuthType Basic
<Limit GET>
require valid-user
</Limit>

* save the file with "control-o" then "enter", exit pico with "control-x" then "enter"
* Now while in that same dir, run this command to add a username and password

htpasswd -c /home/virtual/site25/fst/var/www/.htpasswd YOUR-USER-NAME

It will prompt you to enter a password twice.

That is it, your admin directory is now password protected.

NOTE: If you do not have shell access you will have to use your control panel to password protect the directory.


That was the easy part!You will of course now have to build and configure your store to your specifications and trust me, that is the hard part! Actually this software looks like one of the better carts out there and you can manage very well using the admin page and docs as well as probably a few trips to the osCommerce forum if you run into snags. I won't kid you and say it will be easy if you have never worked with carts before.

Things like shipping logic will hurt your brain at first glance but it is really not that bad. All carts have this stuff and you will have to work through it regardless of what kind of software you use. My point is that you should not expect to have a store up and running overnight, not a full blown cart like this anyway.

A few more helpful tips and links follow...

Your store will be at this URL if you installed it as described...
http://www.yourdomain.com/catalog/catalog/default.php

Your admin page will be at this URL...
http://www.yourdomain.com/admin/admin/index.php

There are a lot of third party developers working on this and you can already find things like PayPal plugins linked on their site.

One last item I will mention. If you don't like the dual dir paths (/catalog/catalog & /admin/admin) you can install this by making a temporary dir and expand the tars there. Then copy the relevant dir structure over to your web root dir but NOT the top dir that was created. In other words, instead of copying the /catalog/catalog/blah/blah/blah tree over to your web root dir, just copy the /catalog/blah/blah/blah tree over. If you do it this way though there are a number of files that will be in your web root dir along with the three sub-dirs (catalog, admin & tep-docs). In my opinion this is sloppy and I did not want to install it this way.I AM GUESSING YOU COULD DO THAT! I did not try it and I have found that playing around with the dir structure on this script is a recipe for headaches... you have been warned.

I can't stress enough that this software is open source and under development. The project is very active and the developers are quite competent, unlike many open source projects, I trust their code. However, don't install this thing without signing their mailing list because there will be hacks and bugs found, that is a guarantee! This is not a problem if you pay attention by getting on their mailing list or watching their forum, patches are released fast and can be applied easily to existing stores.