PDA

View Full Version : PHP/Load Balancing QUESTION


hollywoodnorth
11-22-04, 10:03 PM
in responce to this >>

When we load balanced www11-www18 some people had problems with using URL based includes. If you need to use URL includes that use your own domain name, this makes the php script try to reconnect to the webservers again through the load balancer. This will not work due to network topology limitations when using multiple load balancers. To use your own domain in URL based includes change them from this:

include("http://domain.com/path/to/file.html"); or
include("http://www.domain.com/path/to/file.html");

to use:

include("http://localhost.domain.com/path/to/file.html");

This will cause the php script to connect to the local webserver and retrieve your file. You can change your PHP scripts now and it will work without load balancing. We will be load balancing www01-www10 most likely this evening.


Do I need to change this include line >>

include "news/Classes/news.class.php";

jlovi
11-23-04, 03:22 AM
No...

NMS
11-23-04, 11:56 AM
Do you have a problem with it?

joshuamc
11-23-04, 01:57 PM
include "news/Classes/news.class.php";

If you are not having a problem with it, don't fix it. However, this is an example of an include that we suggest people change. You would want to put:

include "http://localhost.yourdomain.com/news/Classes/news.class.php";

tbonekkt
11-23-04, 02:02 PM
include "http://localhost.yourdomain.com/news/Classes/news.class.php";
Quite the contrary..what the original poster has already is better than using a URL in an include.

Using the server path is most efficient:
<? include("/www/u/username/htdocs/path/to/file.ext"); ?>

But like Josh said, if you're not having a problem, don't change a thing. "If it ain't broke, don't fix it." :)

joshuamc
11-23-04, 02:21 PM
Well, if it was a question of efficiency, then having the full server path is the best way to go. However, I was referring to the php includes announcement. Anyhoo..

tbonekkt
11-23-04, 02:23 PM
include "news/Classes/news.class.php";How funny...I read that as a path rather than a URL..

Nothing like two people seeing the same thing differently :D