Localhost not replicating live server exactly
Posted by: manObject (---.29.216.155.threembb.co.uk)
Date: September 21, 2011 08:26PM

My problem is to do with paths to inline images in HTML coded web pages (I am using Drupal 6.22 - which might be a factor). On my production server, there is no problem, but with the WampServer setup, there is an annoying difference of only a single character, but that character is a forward slash directory delimiter.

Using the production server, the following works perfectly:

HTML code snippet of inline image tag:
src="/internal-path-to-image-files/imagefilename"

corresponding markup produced by Drupal using production server setup:
src="[sitename]; <- this is correct markup

corresponding markup produced by Drupal using WampServer setup on localhost:
src="[localhost]; <- this is wrong markup

This url is way off - it is above the level of the actual website folder ("/sitename/" is missing). To get the snippet to work, I have to delete the leading slash as shown here:

src="internal-path-to-image-files/imagefilename"

This produces:
src="[localhost]; <- this is correct markup

Unfortunately, this way of writing the path does not work on the production server.
I am baffled by this because I downloaded the exact same database and set of website files from the production server to localhost. Everything works perfectly apart from this deeply annoying glitch, which prevents me from doing 100% of website development testing before going live with it.
Any help with this would be MOST welcome!

Thanks one and all.

Options: ReplyQuote
Re: Localhost not replicating live server exactly
Posted by: stevenmartin99 (---.b-ras1.srl.dublin.eircom.net)
Date: September 21, 2011 08:29PM

linux vs windows ?


have a look in the $_SERVER array for the difference between the machines

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: Localhost not replicating live server exactly
Posted by: manObject (---.29.216.155.threembb.co.uk)
Date: September 21, 2011 09:34PM

Hi Steven

Many thanks for your suggestion. I've compared local and live versions of $_SERVER array via phpinfo().
I'm not sure what to look for though. Presumably something like a trailing slash for document_root, http_host, server_name or similar? What I did discover was that the live server is using CGI/FastCGI for the Server API.

Could this be the reason?

Options: ReplyQuote
Re: Localhost not replicating live server exactly
Posted by: stevenmartin99 (---.b-ras1.srl.dublin.eircom.net)
Date: September 21, 2011 09:44PM

yes maybe

normally PHP $_SERVER['SCRIPT_NAME'] will be set to the path of the PHP script that's running.

When running via CGI, it will be the path of the CGI binary.


Also CGI needs the Doc root set in the php.ini where as with wamp that would not be the case..


Maybe you will need to use some other value in the $_SERVER array that is the same on both machines. or use relative paths.

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: Localhost not replicating live server exactly
Posted by: manObject (---.29.216.155.threembb.co.uk)
Date: September 22, 2011 12:35AM

Hi Steven

Thanks again for your help. I'm a bit shaky on server configuration (as you've probably already guessed).
I have also posted to the Drupal forum about this. Perhaps that might shed some light as well.

I'll let you know if and when I find a cure.

Best wishes

Richard Prangnell

Options: ReplyQuote
Re: Localhost not replicating live server exactly
Posted by: yfastud (Moderator)
Date: September 22, 2011 02:25AM

Seems you use localhost to setup drupal instead setup VH and use that VH to setup Drupal so you can have 'http://mydrupal/internal-path-to-image-files/imagefilename%22' instead

No matter within or outside LAN access, you need to setup Access, DNS, and VH; Access for permission to connect to your Wamp PC, DNS to tie Domain(s) to your Wamp PC, and VH to host multiple Domains/Websites/IP's and even you have only 1 Domain/IP, you should use VH to set it up w/ the site you want to show up first on top and localhost on bottom and others in middle if having more than 1 site; w/ VH, other PC's, no matter w/i or outside LAN, can access/see websites/contents of that particular folder set for that particular VH on your wamp PC. If dont have real Domain, just skip DNS guide

To setup Access, follow this
[blog.jlbn.net]

To setup VH, follow this
[blog.jlbn.net]

To setup DNS, follow this
[blog.jlbn.net]

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote


Sorry, only registered users may post in this forum.