Using multiple servers

I am not really sure how to even search for this since most of my searches have came up with odd results.

What I am trying to do is use two servers to host a website. Server 1 already has the main website running with IIS, PHP and MySql. Server 2 has IIS, PHP, MySql and a Website installed similar to a Wordpress or Drupal. I would like to be able to call up a directory via our mainwebsite (i.e. ourwebsite.org/wordpress) and have that use the site that is currently on Server 2.

I have been able to do this using virtual directories but any time a php file calls for a file that is not in the website folder on Server 2 (i.e. c:/windows) it refuses to work.

It should be noted that Server 2 can read that file that is not in the web directory if I go to the Server 2 website on Server 2 by typing in http://localhost or by calling the DNS name of the server in a browser as long as I'm in the network.

When using the ourwebsite.org/wordpress link with the virtual directory it is searching on Server 1's hard drives for that file. It also appears to be using the MySQL database and PHP config from Server 1 as well.

Any suggestions on what to look in to or what to do would be greatly appreciated. I hope I made this clear.

Average rating
(0 votes)
Brashquido's picture

Location: Melbourne, Australia

Joined: Sep 2003

Send PM

Brashquido said:

So I imagine you have set your virtual directory on server 1 to use a share on server 2? Are your servers a part of a domain? If so, then you'll need to set the server 1 computer account for delegation in AD. If not, then you'll need create user account on each server for use with IIS that has exactly the same username and password. Have a look at the guide I wrote on creating user accounts for IIS 6.

----------------
Dominic Ryan
5 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster

Anonymous's picture

Location: Kolkata

Anonymous said:

Thanks for the reply. The servers are part of a domain and your first assumption is correct as well. Server 1 is connecting to Server as an administrator account at the moment. I have read that may not exactly be the safest but at this moment I'm just trying to get it to work.

I have no problem connecting to Server 2 via virtual directory and displaying a page that says "Hello World" or some simple stuff.

The problem occurs when I have page on Server 2 set up with code that is trying to access files on Server 2 outside of the web directory. The website is looking for them on Server 1.

dell73's picture

Joined: Mar 2009

Send PM

dell73 said:

I apologize. It appears I did not log in and posted anonymously above.

Brashquido's picture

Location: Melbourne, Australia

Joined: Sep 2003

Send PM

Brashquido said:

How have you got authentication set on server one (anonymous, Windows Intergrated, etc)? Have you configured delegation for the computer account? Is there anything in the eventlog or PHP log? I'm wondering if an include or similar is causing this issue.

----------------
Dominic Ryan
5 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster

dell73's picture

Joined: Mar 2009

Send PM

dell73 said:

It does indeed effect the includes. So for example if my web directory on Server 2 is C:/webfolder and let's say I have a data folder that stores user information on Server 2 in C:/user_data. So then if I were to do a php include('/user_data/file.txt'), Server 1 (which is hosting the main website and has a virtual directory to Server 2's folder C:/webfolder) would be looking in it's C drive.

Authentication on Server one is set to anonymous using the internet user account. Not sure if it is important to state but Server 1 is Win 2003 and Server 2 is Win 2008.

I have not messed with delegation I do not believe but I will look into it. I was hoping this was a simple and common problem for hosting different sections of websites on different servers.

Brashquido's picture

Location: Melbourne, Australia

Joined: Sep 2003

Send PM

Brashquido said:

Just realised what was different last time I came across this. Last time the paths in the includes were UNC, so \\servername\share rather than c:\path. It is in this situation that you require the computer account be trusted for delegation.

Your situation is the opposite where IIS is connecting to the UNC, and your PHP app is referring to the local file system. You could try editing the ABSPATH value in your wp-config.php so that is referring to the UNC rather than the local file system. Indecently, are you using FastCGI or ISAPI?

----------------
Dominic Ryan
5 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster

dell73's picture

Joined: Mar 2009

Send PM

dell73 said:

Alright. I've made progress doing some of the things you mentioned (fixed my config file to fix most issues. Simple mistakes I should have seen). My site can accurately access the files and database that is on a different server without a problem.

The only issue now is that I am still using Server 1 to do all the PHP work. So I have tried to simplify the question now.

Server 1 hosts the main website. Server 2 hosts the wordpress-like section. So I have a directory on Server 1 that is a virtual directory which gets the files off of Server 2 to display this wordpress-like section. Is there a way that I can make Server 2 do all the work, using the PHP on Server 2, when someone goes to that directory (www.mysite.com/wordpress) on my website.

I hope that question makes sense. If there is not a way to do it, I can just use another website address (i.e. www.wp.mysite.com)

Thanks for all your help so far. And Server 1 which is Windows 2003 is running on ISAPI while Server 2 which is a Windows 2008 server is currently trying out FastCGI since it appears to work better on Windows 2008 then ISAPI was working.