Forum Moderators: mack

Message Too Old, No Replies

exporting working website to local machine for testing

         

kid185

2:27 pm on Feb 15, 2007 (gmt 0)

10+ Year Member



Hi everyone,

I hope someone can help me. I work for a small company and my boss had someone develope our website which is being hosted offsite. However, the person that developed the website now has little time to make changes for us, and the boss wants to create a webserver for onsite testing here, so we can make minor changes to the site and test them before uploading them to the host. I hope i put that all simple enough for everyone to understand.

Since I knew nothing about web servers and such, I started looking in the Internet for Webserver software, and downloaded WAMP5, XAMPP, and Uniform Server to try and set something up for test purposes here. I want to do this on a Windows XP Pro machine, and these packages seem to be good for this. After lots of trial and error, I found that I am most happy with WAMP5 since it lets me turn off/on modules in Apache/PHP, and Start/Stop Apache and Mysql services through the menu in the taskbar icon.

After getting the Server installed, so that mysql, php and the Apache server all are running, I downloaded our website folder over ftp from our host to my local server. and put it into the www folder in WAMP5. I then exported our database from the host and imported through PHPmysql into mysql on my local machine.

All should work just fine now, or so i thought. After getting lots of errors trying to call up my website, I turned on the necessary modules like rewrite_module and such in Apache and register globals, short open tags in PHP (error messages led me to know they needed to be enabled), and changed the define Http... in the configure.php file to reflect the different host address. After all this, and setting up a virtual host for the new host address, mapping it to localhost, I finally got the index.php to open in the browser.

So, finally! My problem. When i click on a link in the homepage menu, i only get a Website not found message from the browser. The whole website is built as php files that build a htm file to be displayed (the address in the browser shows up as #*$!.htm when I click on a link.

What did i not configure right or not enable that is keeping my website from working locally like it does when accessing the real online site over the internet? Or is this one of those complicated things where one would need to know how the website is set up? As far as i can see, none of the php files have reference to our actual domain name except the one configure.php that i mentioned earlier. And a copy of our website is also on the host site from the person who developed the website for us. He used it to show my boss his changes before uploading them to our actual site.

Im just too inexperienced to figure this out alone, and the one that wrote the website isnt available to ask. Anyone have any ideas?

jatar_k

11:22 am on Feb 17, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld kid185,

it's actually a bit of a tough question. So your only problem is the links?

>> I turned on the necessary modules like rewrite_module

it's possible it's the rewrite that is not working

can you explain how exactly the links are misbehaving? are they going to the wrong place? are they all just 404s?

you might want to turn off the rewrite and see if that helps.

cmarshall

1:29 pm on Feb 17, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As Jatar pointed out, there are, literally, hundreds of variables here. mod_rewrite is a "usual suspect." Even minor mistakes in rewrite rules can generate a plethora of entertaining errors.

The first thing you should do is ensure that you understand your ISP server and PHP environment. I find that phpinfo() [us3.php.net] usually gives me all the info I need. You can also use Netcraft's What's that Site Running? [uptime.netcraft.com] to get a bit of information. The Netcraft tool is useful for finding out a bit more about what kind of load your hosting provider is subjecting your server to. It may also give you a heads up to potential problems, such as if they are running a gambling site on your server, there may be a DDOS attack in your future, or if they are running a pr0n site, your domain may get blacklisted.

But I digress. I have two levels of testing servers in my site development. The first is my laptop, which is a Mac, and is set up as a complete BAMP (BSD Apache MySQL PHP) system. I also have a number of Parallels Desktop VMs that I use to run local tests.

The second level is usually a subdirectory on the server itself. I direct Dreamweaver's testing server to this subdirectory, and cloak it in the main site. Since I use relative addressing in everything I do, this gives me a complete standalone test, running on the host environment (this is important, because they often have a slightly different PHP or MySQL version than do I). I have, at times, also registered a second account with my hosting provider in order to have a sandbox.

Just my $0.02.

kid185

4:45 pm on Feb 18, 2007 (gmt 0)

10+ Year Member



thank you all for the response.

In answer to Jatars question, the links give 404 website not found errors.

The problem is that the website works from the webhost, just not at the office in my local machine. So obviously the rewrites do there job on the actual website.

The phps for their part are loadable in the browser when i call the actual php files in the url.

I may have made the mistake of changing the domain name for the local machine, i called it mytest.de instead of www.test.de. Its just that i have to know for sure that i am working on the website locally and not viewing the one from the webhost in the browser. Since the phps are supposed to all be written with relative addresses, i cant see how this could break anything though.

The only PHP file that i found on the whole website that refers to our www address is in the configure.php found in the includes directory. it looks like this:

<?php
/*
osCommerce, Open Source E-Commerce Solutions
[oscommerce.com...]

Copyright (c) 2003 osCommerce

Released under the GNU General Public License
*/

// Define the webserver and path parameters
// * DIR_FS_* = Filesystem directories (local/physical)
// * DIR_WS_* = Webserver directories (virtual/URL)
define('HTTP_SERVER', 'http://www.test.de'); // eg, [localhost...] - should not be empty for productive servers
define('HTTPS_SERVER', 'https://www.test.de'); // eg, [localhost...] - should not be empty for productive servers
define('ENABLE_SSL', false); // secure webserver for checkout procedure?
define('HTTP_COOKIE_DOMAIN', 'test.de');
define('HTTPS_COOKIE_DOMAIN', '');
define('HTTP_COOKIE_PATH', '/');
define('HTTPS_COOKIE_PATH', '');
define('DIR_WS_HTTP_CATALOG', '/');
define('DIR_WS_HTTPS_CATALOG', '');
define('DIR_WS_IMAGES', 'images/');
define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');
define('DIR_WS_INCLUDES', 'includes/');
define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');
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', 'pub/');
define('DIR_FS_CATALOG', '/www/htdocs/test/');
define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

// define our database connection
define('DB_SERVER', 'localhost'); // eg, localhost - should not be empty for productive servers
define('DB_SERVER_USERNAME', 'yyyyyyy');
define('DB_SERVER_PASSWORD', 'yyyyyyy');
define('DB_DATABASE', 'd001ef84');
define('USE_PCONNECT', 'false'); // use persistent connections?
define('STORE_SESSIONS', 'mysql'); // leave empty '' for default handler or set to 'mysql'
?>

i changed the name of the actuall website to test for posting. Of course it has a different domain name in the actual configure.php file as well as different password and username for the database.

The htaccess file looks like this:

# The following makes adjustments to the SSL protocol for Internet
# Explorer browsers

<IfModule mod_setenvif.c>
<IfDefine SSL>
SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
</IfDefine>
</IfModule>
#
Options +FollowSymLinks
RewriteEngine on

RewriteBase /
RewriteRule admin - [L]

RewriteRule ^([a-z0-9_]+)\.htm$ /index.php?link=$1 [nocase,QSA,L]
RewriteRule ^([A-Z-])\.shtml$ /alph_search_res.php?keywords=$1 [nocase,QSA,L]

RewriteCond %{REQUEST_URI}!-d
RewriteCond %{REQUEST_URI}!^/$
RewriteCond %{REQUEST_URI}!^/download/([A-Za-z0-9\-_]+)\.zip$
RewriteCond %{REQUEST_URI}!^/download/pdf/([A-Za-z0-9\-_]+)\.pdf$
RewriteCond %{REQUEST_URI}!^/download/zip/([A-Za-z0-9\-_]+)\.zip$
RewriteCond %{REQUEST_URI}!^/cgi-bin/sysinfo/([A-Za-z0-9_]+)\.([a-z]+)$
RewriteCond %{REQUEST_URI}!^/html/([A-Za-z0-9_]+)\.([a-z]+)$
RewriteCond %{REQUEST_URI}!^/logs/([A-Za-z0-9_]+)\.([a-z]+)$
RewriteCond %{REQUEST_URI}!^/usage/([A-Za-z0-9_]+)\.([a-z]+)$
RewriteRule!\.(gif¦php¦css¦jpg)$ /rewrite.php [nocase]

# Fix certain PHP values
php_value session.use_trans_sid 0
php_value register_globals 1

maybe you can see something that causes it not to work when i call the website something different than www.mydomain.de on my local machine. I still think i may not have some module turned on, or something like that. But then again, i am still very new to all this

jatar_k

3:37 pm on Feb 19, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



have you changed the config for the local machine to reflect the differences from your production environment?

kid185

5:33 pm on Feb 19, 2007 (gmt 0)

10+ Year Member



I found out what the problem was.

I had to add the following to the httpd.conf file

<Directory "g:/wamp/www/mytest.de">
AllowOverride All
Order allow,deny
Allow from all
</Directory>

after this, the website works in my offline test environment just like it does online from the host. I had tried this before, but I didnt know that i needed to set AllowOverride to All. Before it was set to None.

Thanks for your help. Maybe someone else with a similar problem will find this information of some use in the future.

Have a nice day

Kid185

jatar_k

5:38 pm on Feb 19, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



nice work kid185

glad you got it working