Zen Cart Logo
Forums / Installing on a Windows Server / Trouble setting up a test environment (WAMP and XAMPP)

Trouble setting up a test environment (WAMP and XAMPP)

Views: 4,156

Results 1 to 9 of 9
12 Oct 2014, 4:09 AM
#1
nikerymis avatar

nikerymis

New Zenner

Join Date:
Oct 2009
Location:
Ohio
Posts:
19
Plugin Contributions:
0

Trouble setting up a test environment (WAMP and XAMPP)

I'm trying to be a responsible hack (hah) and not make changes directly to my live site, but I'm having trouble setting up a test environment. I'm pretty sure I'm missing something obvious (I usually am; I'm self-taught and have holes the size of 18-wheelers in my knowledge). I've tried to work with both WAMP and XAMPP, with no success. I keep getting blank white screens or time outs when I try to load the test environment. I searched the forum for similar errors, but most of those have to do with SEO URL add-ons, which I don't have installed.

So here's what I did, and maybe someone can point out what I've missed? (I tried WAMP and XAMPP, but I'm going to focus on WAMP, because I find it a little easier to work with.) I'm working with zen 1.5.1 at the moment.

  1. I installed WAMP 2.5, PHP 5.5.12, Apache 2.4.9, MySQL 5.6.17.
  2. I FTP'd a copy of my catalog to C:/wamp/www/books2, minus the downloads folder (it's got a lot of large files).
  3. I exported my SQL database from my live environment, and imported it into the test phpMyAdmin.
  4. I updated the two configure files (below) to point to the new database, localhost, and new file location.

I didn't immediately create the downloads/ directory, but I did try creating it and downloaded the .htaccess file from the live server. That didn't have any effect, however. I've tried a couple different things (going both ways on the / \ in the file directory, but that only changes whether I've got the blank white page or the timeout). I figure blank white page is better, sort of.

I stumbled across doing a local/configure.php to get more intensive error checking, and I get this on the main books2 index, but not on the subfolders (I tried loading admin, got a blank white page).

( ! ) Parse error: syntax error, unexpected 'DIR_FS_DOWNLOAD' (T_STRING) in C:\wamp\www\books2\includes\configure.php on line 41
Call Stack

Time Memory Function Location

1 0.0010 257288 {main}( ) ..\index.php:0
2 0.0020 299312 require( 'C:\wamp\www\books2\includes\application_top.php' ) ..\index.php:51

I've compared the configure.php and application_top.php files to the base 1.5.1 files, but i can't spot anything out of place (no stray apostrophes or weirdness that I can tell).

In any case, here's the contents of \books2\includes\configure.php

<?php
/**
 * dist-configure.php
 *
 * @package Configuration Settings
 * @copyright Copyright 2003-2012 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version GIT: $Id: Author: DrByte  Tue Jul 31 17:24:25 2012 -0400 Modified in v1.5.1 $
 * @private
 */
// Define the webserver and path parameters
// HTTP_SERVER is your Main webserver: eg-http://www.yourdomain.com
// HTTPS_SERVER is your Secure webserver: eg-https://www.yourdomain.com
define('HTTP_SERVER', 'http://localhost');
define('HTTPS_SERVER', 'https://localhost');

// Use secure webserver for checkout procedure?
define('ENABLE_SSL', 'false');

// NOTE: be sure to leave the trailing '/' at the end of these lines if you make changes!

// * DIR_WS_* = Webserver directories (virtual/URL)
// these paths are relative to top of your webspace ... (ie: under the public_html or httpdocs folder)
define('DIR_WS_CATALOG', '/books2/');
define('DIR_WS_HTTPS_CATALOG', '/books2/');

define('DIR_WS_IMAGES', 'images/');
define('DIR_WS_INCLUDES', 'includes/');
define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');
define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');
define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');
define('DIR_WS_DOWNLOAD_PUBLIC', DIR_WS_CATALOG . 'pub/');
define('DIR_WS_TEMPLATES', DIR_WS_INCLUDES . 'templates/');

// * DIR_FS_* = Filesystem directories (local/physical)
//the following path is a COMPLETE path to your Zen Cart files. eg: /var/www/vhost/accountname/public_html/store/
define('DIR_FS_CATALOG', 'C:\wamp\www\books2\');

define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');
define('DIR_WS_UPLOADS', DIR_WS_IMAGES . 'uploads/');
define('DIR_FS_UPLOADS', DIR_FS_CATALOG . DIR_WS_UPLOADS);
define('DIR_FS_EMAIL_TEMPLATES', DIR_FS_CATALOG . 'email/');

// define our database connection
define('DB_TYPE', 'mysql');
define('DB_PREFIX', ''); // prefix for database table names -- preferred to be left empty
define('DB_CHARSET', 'latin1');
define('DB_SERVER', 'localhost');
define('DB_SERVER_USERNAME', 'root');
define('DB_SERVER_PASSWORD', '');
define('DB_DATABASE', 'zcwamp');

// The next 2 "defines" are for SQL cache support.
// For SQL_CACHE_METHOD, you can select from:  none, database, or file
// If you choose "file", then you need to set the DIR_FS_SQL_CACHE to a directory where your apache
// or webserver user has write privileges (chmod 666 or 777). We recommend using the "cache" folder inside the Zen Cart folder
// ie: /path/to/your/webspace/public_html/zen/cache   -- leave no trailing slash
define('SQL_CACHE_METHOD', 'none');
define('DIR_FS_SQL_CACHE', 'C:\wamp\www\books2\cache');

and here is \books2\admin\includes\configure.php (admin is not the actual name of that directory :smile:)

<?php
/**
 * SAMPLE dist-configure.php
 *
 * @package Configuration Settings
 * @package Admin
 * @copyright Copyright 2003-2012 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version GIT: $Id: Author: DrByte  Tue Jul 31 17:24:25 2012 -0400 Modified in v1.5.1 $
 * @private
 */
/**
 * WE RECOMMEND THAT YOU USE SSL PROTECTION FOR YOUR ENTIRE ADMIN:
 * To do that, make sure you use a "https:" URL for BOTH the HTTP_SERVER and HTTPS_SERVER entries:
 */
  define('HTTP_SERVER', 'http://localhost');
  define('HTTPS_SERVER', 'https://localhost');
  define('HTTP_CATALOG_SERVER', 'https://localhost');
  define('HTTPS_CATALOG_SERVER', 'https://localhost');

  // secure webserver for admin?  Valid choices are 'true' or 'false' (including quotes).
  define('ENABLE_SSL_ADMIN', 'false');

  // secure webserver for storefront?  Valid choices are 'true' or 'false' (including quotes).
  define('ENABLE_SSL_CATALOG', 'false');

// NOTE: be sure to leave the trailing '/' at the end of these lines if you make changes!
// * DIR_WS_* = Webserver directories (virtual/URL)
  // these paths are relative to top of your webspace ... (ie: under the public_html or httpdocs folder)
  $t1 = parse_url(HTTP_SERVER);$p1 = $t1['path'];$t2 = parse_url(HTTPS_SERVER);$p2 = $t2['path'];
  
  define('DIR_WS_ADMIN', preg_replace('#^' . str_replace('-', '\-', $p1) . '#', '', dirname($_SERVER['SCRIPT_NAME'])) . '/');
  define('DIR_WS_CATALOG', '/books2/');
  define('DIR_WS_HTTPS_ADMIN', preg_replace('#^' . str_replace('-', '\-', $p2) . '#', '', dirname($_SERVER['SCRIPT_NAME'])) . '/');
  define('DIR_WS_HTTPS_CATALOG', '/books2/');

  define('DIR_WS_IMAGES', 'images/');
  define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');
  define('DIR_WS_CATALOG_IMAGES', HTTP_CATALOG_SERVER . DIR_WS_CATALOG . 'images/');
  define('DIR_WS_CATALOG_TEMPLATE', HTTP_CATALOG_SERVER . DIR_WS_CATALOG . 'includes/templates/');
  define('DIR_WS_INCLUDES', 'includes/');
  define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');
  define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
  define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');
  define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');
  define('DIR_WS_CATALOG_LANGUAGES', HTTP_CATALOG_SERVER . DIR_WS_CATALOG . 'includes/languages/');

// * DIR_FS_* = Filesystem directories (local/physical)
  define('DIR_FS_ADMIN', realpath(dirname(__FILE__) . '/../') . '/');
  define('DIR_FS_CATALOG', 'C:\wamp\www\books2');

  define('DIR_FS_CATALOG_LANGUAGES', DIR_FS_CATALOG . 'includes/languages/');
  define('DIR_FS_CATALOG_IMAGES', DIR_FS_CATALOG . 'images/');
  define('DIR_FS_CATALOG_MODULES', DIR_FS_CATALOG . 'includes/modules/');
  define('DIR_FS_CATALOG_TEMPLATES', DIR_FS_CATALOG . 'includes/templates/');
  define('DIR_FS_BACKUP', DIR_FS_ADMIN . 'backups/');
  define('DIR_FS_EMAIL_TEMPLATES', DIR_FS_CATALOG . 'email/');
  define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');

// define our database connection
  define('DB_TYPE', 'mysql');
  define('DB_PREFIX', '');
  define('DB_CHARSET', 'latin1');
  define('DB_SERVER', 'localhost');
  define('DB_SERVER_USERNAME', 'root');
  define('DB_SERVER_PASSWORD', '');
  define('DB_DATABASE', 'zcwamp');

  // The next 2 "defines" are for SQL cache support.
  // For SQL_CACHE_METHOD, you can select from:  none, database, or file
  // If you choose "file", then you need to set the DIR_FS_SQL_CACHE to a directory where your apache
  // or webserver user has write privileges (chmod 666 or 777). We recommend using the "cache" folder inside the Zen Cart folder
  // ie: /path/to/your/webspace/public_html/zen/cache   -- leave no trailing slash
  define('SQL_CACHE_METHOD', 'none');
  define('DIR_FS_SQL_CACHE', 'C:\wamp\www\books2\cache');


//Explanations of the webserver and path parameters:
// HTTP_SERVER is your Main webserver: eg-http://www.yourdomain.com
// HTTPS_SERVER is your Secure webserver: eg-https://www.yourdomain.com
// HTTP_CATALOG_SERVER is your Main webserver: eg-http://www.yourdomain.com
// HTTPS_CATALOG_SERVER is your Secure webserver: eg-https://www.yourdomain.com
/*
 * URLs for your site will be built via:
 *     HTTP_SERVER plus DIR_WS_ADMIN or
 *     HTTPS_SERVER plus DIR_WS_HTTPS_ADMIN or
 *     HTTP_SERVER plus DIR_WS_CATALOG or
 *     HTTPS_SERVER plus DIR_WS_HTTPS_CATALOG
 * ...depending on your system configuration settings
 */

Any help would be greatly appreciated!

12 Oct 2014, 4:54 AM
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Trouble setting up a test environment (WAMP and XAMPP)

I'm thinking that if you are going to keep the backward slashes that they need tobe escaped by doubling them up. I'm not in front of my computer to tell if that is/was how it was done on my local setup. I thought it was with a forward slash, but if that's not working at all, then...

The other thing to do/try is create a file that is a basic webpage nd see if that works on your local system. So all of the typical html tags, and just a simple statement like hello world. If it displays then the next think to tackle is something as "large" as Zen Cart. I saw that php 5.5 was involved, but it seemed like that was for mySQL. Realize that if using zc v151, that the version of php really should be 5.3 or so.

12 Oct 2014, 8:42 AM
#3
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: Trouble setting up a test environment (WAMP and XAMPP)

Like **mc12345678** said, the back slashes should be forward slashes,
so ```
C:\wamp\www\books2

should be```
C:/wamp/www/books2
12 Oct 2014, 6:50 PM
#4
nikerymis avatar

nikerymis

New Zenner

Join Date:
Oct 2009
Location:
Ohio
Posts:
19
Plugin Contributions:
0

Re: Trouble setting up a test environment (WAMP and XAMPP)

I've tried the backslash in the path (C:/www/wamp/books2/), but that always gives me a "webpage not available" error. It might be what's supposed to work, but for whatever reason it doesn't.

Forward slashes (C:\www\wamp\books2) gives me the blank white screen (w/out strict error reporting) or the error message I noted in my first post (with strict error reporting on).

I tried escaping the forward slashes by doubling them up (C:\www\wamp\books2\), but that also gives me the "webpage not available" error.

(I should note that I'm updating all the URLs in both configure files, not just the one I'm noting above for examples.)

I do have a general webpage file in there, and that loads properly without any issue when I go straight to it. It's in the \books2\ directory, so it's not just that.

One thing I forgot to mention; every time I try to load this, it sets \books2\includes\configure.php to read-only. I assumed that was a thing Zen Cart does for security, so it might not have anything to do with this, but I figured it was worth mentioning just in case.

I wonder if it is a PHP mismatch problem. My live environment is running on 5.5.17 (my host pushed it up there, and it's one of the reasons I want to get a test environment working so I can upgrade to 1.5.3). I'll see if I can sort out how to change the PHP version for WAMP to match and then try again.

Thanks for the help! I'll let ya'll know if the PHP thing works, but if you've got any other suggestions, please let me know. I'm willing to try pretty much anything. :-)

12 Oct 2014, 7:09 PM
#5
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Trouble setting up a test environment (WAMP and XAMPP)

nikerymis:

I've tried the backslash in the path (C:/www/wamp/books2/), but that always gives me a "webpage not available" error. It might be what's supposed to work, but for whatever reason it doesn't.

Forward slashes (C:\www\wamp\books2) gives me the blank white screen (w/out strict error reporting) or the error message I noted in my first post (with strict error reporting on).

I tried escaping the forward slashes by doubling them up (C:\www\wamp\books2\), but that also gives me the "webpage not available" error.

(I should note that I'm updating all the URLs in both configure files, not just the one I'm noting above for examples.)

I do have a general webpage file in there, and that loads properly without any issue when I go straight to it. It's in the \books2\ directory, so it's not just that.

One thing I forgot to mention; every time I try to load this, it sets \books2\includes\configure.php to read-only. I assumed that was a thing Zen Cart does for security, so it might not have anything to do with this, but I figured it was worth mentioning just in case.

I wonder if it is a PHP mismatch problem. My live environment is running on 5.5.17 (my host pushed it up there, and it's one of the reasons I want to get a test environment working so I can upgrade to 1.5.3). I'll see if I can sort out how to change the PHP version for WAMP to match and then try again.

Thanks for the help! I'll let ya'll know if the PHP thing works, but if you've got any other suggestions, please let me know. I'm willing to try pretty much anything. :-)

So, if the "general file" works if going straight to the page/link, does the page include php code in it?

If though, you are running php 5.5 on the server and still using ZC 1.5.1, there are actions necessary to make it work which is why ZC 1.5.3 came along...

At the moment though there is an aspect of doubt on what is really working and what is not.. So, important to build up to the full desired result knowing that the steps to get there are working satisfactory.

The blank screen is indicating that execution is stopping somewhere along the way and at the moment it is at a point where the chosen "markings" are known to require additional/different characters. by having for example \b inside the single quotes the system is trying to escape the b which is a backspace character... See: http://php.net/manual/en/regexp.reference.escape.php

So, suggest replacing \ with / and start searching through logs for the other error(s) and solution(s).

12 Oct 2014, 9:19 PM
#6
nikerymis avatar

nikerymis

New Zenner

Join Date:
Oct 2009
Location:
Ohio
Posts:
19
Plugin Contributions:
0

Re: Trouble setting up a test environment (WAMP and XAMPP)

The general file I'm referring to that is loading isn't related to zen cart. It is a PHP file, but most of the PHP coding is negligible (pulling in my website's standard header and footer, etc.), and it loads OK, no errors.

I know there's some issues with 1.5.1 and php 5.4 and 5.5, which is why I'm trying to set up this test environment to upgrade. I'm getting error log files generated on the live site during checkout, though everything works from the customer's perspective (the logs are warnings, typically).

OK, so from what I understand, I'm getting the white screen/errors because the forward slash is screwing things up b/c of the php escape sequences being translated, so the backslash is the way to go (or, I suppose the escaped forward slash, but if I'm going to have problems either way, better go the proper way :smile:).

So with the backslash, I can't get any of the Zen Cart pages to load, and none of them are producing error logs (the /books2/logs directory is empty). Is there somewhere else I can find an error log? I also checked on the PHP, Apache, and MySQL error logs for WAMP server, but they don't have any messages (that aren't related to the forward slash problem). Is this something I should take to the WAMP server forums instead?

12 Oct 2014, 9:33 PM
#7
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Trouble setting up a test environment (WAMP and XAMPP)

Well, maybe, but at the same time, this issue is still related to this thread...

So the "error" is occurring before ZC is able to generate error logs or to understand what to do when an error does occur. So, the next thing to do is to basically let the errors be shown... :) Still a local server so no issues there. I mean between php.ini and turning on error logging and even in each of the application_top.php files there is error tracking available. Have you tried verifying that you can load a index.php or index.html file? As it is index.php that is primarily running the system.

14 Oct 2014, 10:04 PM
#8
nikerymis avatar

nikerymis

New Zenner

Join Date:
Oct 2009
Location:
Ohio
Posts:
19
Plugin Contributions:
0

Re: Trouble setting up a test environment (WAMP and XAMPP)

OK, so I couldn't get any errors to log, no matter what I did. I turned on strict error reporting (creating the \includes\extra_configures\strict_error_reporting.php file) and also commented out the if/else loop in application_top.php to see if I could get anything (basically making it so that the error reporting always ran without checking if strict error reporting was on). That got me nothing.

I poked around in php.ini, but I couldn't see where to do anything more. Detailed error reports were on, and so were display options.

I also created a small, non-Zen Cart index.php and loaded that from the main catalog directory. That worked fine.

This does have a (sort of) happy ending, though! I went back to the idea that it might be a PHP version conflict (actually had a thought that maybe it was the Apache version). I uninstalled the latest version of WAMP (2.5) and installed an older version (2.2) instead. WAMP 2.2 (or at least, the version I grabbed from sourceforge) runs PHP 5.3.10, Apache 2.2.21. I'm not sure if it was the PHP or the Apache that was the issue (2.5 had the specs above - 5.5.12 for PHP, 2.4.9 for Apache) and my host runs 5.5.17 for PHP and 2.2.29 for Apache, but the catalog is working! I'm getting no errors, white screens, or failures to load with WAMP 2.2.

Once I've tested out Zen 1.5.3 and installed in in the live environment, I'll roll back up to WAMP 2.5, but at least now I can test 1.5.3. Thank you mc12345678! I really appreciate all the guidance. :-)

16 Oct 2014, 12:17 AM
#9
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Trouble setting up a test environment (WAMP and XAMPP)

Your initial problem was definitely the backslash before the single-quote: ```
define('DIR_FS_CATALOG', 'C:\wamp\www\books2');


Using forward-slashes is always safer.  Otherwise add an extra backslash before the quote.

ie: best:

define('DIR_FS_CATALOG', 'C:/wamp/www/books2/');


or, second-best:

define('DIR_FS_CATALOG', 'C:\wamp\www\books2\');