Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to create a development environment?


raddygast

Recommended Posts

Hi,

 

In reading many posts on this forum, I continue to come across a piece of advice I don't have the ability to follow: Test your changes on a development environment before applying to your live site!

 

I'd love to do this, especially once my site goes live (which it will in a day or two). The problem is, I have no development environment. What's more, I am pretty unclear about how to create one.

 

There are obviously two options. One is to have another development environment with my hosting provider. The other is to set up a development environment at home. Both present problems, and I'm going to list them. Please correct me if I'm wrong, and let me know if things are easier than they seem.

 

ONLINE

 

1. I would need another MySQL Database. Unfortunately, I don't have the option with my host, unless I upgrade my package to one that is twice the cost. Is another DB absolutely necessary? Or could I just backup my DB before working on the site, and roll back if something screws up? Something tells me no... because customers may need to access and use the live site while I'm doing the developing/testing.

 

2. Do I need another SSL certificate? Or can I just use the same hostname, and install a test version of osC into another directory, say, /test/catalog ?

 

3. Would this impact the Paypal-IPN module, which simply contacts the hostname of your site at a certain port, to open the ipn.php file? Or does that use a path that is specific enough that it would contact the correct ipn.php file (i.e. the one in the test site, or the live site)?

 

HOME

 

1. I can install one of those all-in-one packages containing PHP, MySQL, and a webserver. (xampp). However, the environment is going to be weird. Specifically, all the pathnames will be off, at least in configure.php and maybe a few other places (the Paypal-IPN module if I recall correctly has a couple of spots for absolute paths).

 

2. I won't have an SSL cert. for my home webserver, nor will I actually have a proper hostname except "localhost". In that case, how is Paypal-IPN going to be able to even contact my computer with no FQDN?

 

3. I have a home router -- I'm going to have to do all sorts of fancy port-forwarding, aren't I?

 

4. How does one actually copy the contents of a DB (the live site) to another DB (the test site)?

 

 

Anyway, a ton of questions and concerns here. But I know a lot of you DO have development environments so I'm really hoping for a helping hand on this one. I would like to continue on features and functionality on my site (CRedit Class and Gift Vouchers, further site appearance customizations, and so forth), but can't afford to "perfect" my site before launching it. For that reason, I will need a suitable way to do further modifications without impacting the customer base.

 

Help is greatly appreciated.

Link to comment
Share on other sites

I'll answer what I can to the best of my ability.....

 

ONLINE

1, You could prefix the tablenames for the test environ e.g. TEST_PRODUCTS_DESCRIPTION and edit database_tables.php accordingly in catalog and admin.

 

Don't test on your live store

 

2, Just put it in a subdirectory and password it with .htaccess

 

3, shouldn't be a problem provided your settings are ok in the test site.

 

OFFLINE

 

1, I'm not sure how you expose your local server to the outside world (or even if you can??) or why you'd want to. Only the configure.php's need change! If the paypal IPN is working then what is there to test?

 

2, ???

 

3, ????

 

4, Save a backup from the live site and install it in the test site using phpmyadmin.

Light, in the absence of eyes, illuminates nothing.

Link to comment
Share on other sites

Its easier to develop local either use an all in 1 package or install each package.

 

Copy your configs to the local dir and osc will use it instead and dont put any local dir on the server.

 

Server

catalog/includes/configure.php

 

Local

catalog/includes/local/configure.php

 

Same for admin

 

To develop payment gateways like IPN you can use another directory and prefix the tables so they are in the same database

 

catalog/includes/database_tables.php

define('TABLE_ADDRESS_BOOK', 'address_book');

 

dev/includes/database_tables.php

define('TABLE_ADDRESS_BOOK', 'dev_address_book');

 

Your best bet is to get a SSL cert $50/yr or you can use shared SSL if your host offers it.

You dont really need SSL for local dev and testing it only matters if it works on the live site.

 

Its better if you put osc in the root directory instead of catalog.

 

Install Apache/PHP/MySQL

http://www.webmasterstop.com/48.html

 

Try phpMyAdmin for managing your databases.

http://www.phpmyadmin.net/home_page/

 

Try WinSCP for FTP its good with timestamp to help keep local/server synced.

http://winscp.net/eng/index.php

 

Try Zend IDE for debugger

http://www.zend.com/

Link to comment
Share on other sites

Thanks for your reply. However I am having trouble following it.

 

Its easier to develop local either use an all in 1 package or install each package.

 

Yeah, no problem, I'll use an all in one like xampp.

 

Copy your configs to the local dir and osc will use it instead and dont put any local dir on the server.

 

Server

catalog/includes/configure.php

 

Local

catalog/includes/local/configure.php

 

Ok, this I don't get. First, why put the local directory under includes? Second, if I create this sort of hierarchy, won't I have to reconfigure many files in the local osC installation?

 

Basically, I'm just looking for a way to have the local environment match the live one as closely as possible, so that if I make changes to php files that work on the testing (local) computer, I can just upload them to the appropriate place on the live server and they'll still work. Otherwise I'm going to have to go through and hand-change all references to "/local".

 

To develop payment gateways like IPN you can use another directory and prefix the tables so they are in the same database

 

catalog/includes/database_tables.php

define('TABLE_ADDRESS_BOOK', 'address_book');

 

dev/includes/database_tables.php

define('TABLE_ADDRESS_BOOK', 'dev_address_book');

 

How does this table prefixing work? Are you saying to test payment gateways that I can do this on my hosting server, only I should make a copy of my live osC installation (into /dev instead of /catalog), and redefine TABLE_ADDRESS_BOOK ? So this would use the same DB but it would put a "dev_" prefix on all database variables?

 

Your best bet is to get a SSL cert $50/yr or you can use shared SSL if your host offers it.

You dont really need SSL for local dev and testing it only matters if it works on the live site.

 

I already have a dedicated SSL cert. I guess it makes sense that I don't need to use SSL for testing -- but it was just one more variable that I had wanted to eliminate in testing. However I think the way it's working now is fairly clean so I don't need to worry too much.

 

Its better if you put osc in the root directory instead of catalog.

 

People say this, but I fail to understand why. What if I want a main splash page for my website before the user is redirected to the store? I have full control over the content of that page, and am not constrained by osC formatting.

Link to comment
Share on other sites

No idea why it was said to be like

 

Server

catalog/includes/configure.php

 

Local

catalog/includes/local/configure.php

 

If you run it locally you can have the same exact configuration as you would online.

 

I use easyphp so my site locally is

c/programfiles/easyphp/www/index.php and the rest of the osCommerce files

 

 

I think a lot of people say to have it in your root folder cause splash pages tend to annoy folks. I know they do me. If i go to a site i wanna go to the site not have to click to get in.

Wendy James

 

Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.

Link to comment
Share on other sites

OSC loads the config file like this everything else is the same

 

// Set the local configuration parameters - mainly for developers
 if (file_exists('includes/local/configure.php')) include('includes/local/configure.php');

// include server parameters
 require('includes/configure.php');

 

You edit and test local then FTP and test on your server. To do things like IPN you FTP to a dev dir and test when it works then FTP to live dir.

 

How does this table prefixing work? Are you saying to test payment gateways that I can do this on my hosting server, only I should make a copy of my live osC installation (into /dev instead of /catalog), and redefine TABLE_ADDRESS_BOOK ? So this would use the same DB but it would put a "dev_" prefix on all database variables

 

Copy database_tables.php to dev_database_tables.php prefix ALL the tables with dev_ and when you FTP to the dev dir rename it without dev_. Then copy oscommerce.sql to dev_oscommerce.sql, prefix all the tables and import with phpMyAdmin. You will have 1 database with lots of tables.

 

People say this, but I fail to understand why. What if I want a main splash page for my website before the user is redirected to the store? I have full control over the content of that page, and am not constrained by osC formatting.

 

You control this by editing the .htaccess file and set the index order

 

DirectoryIndex index.html index.php

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...