Page 1 of 1

Run PHP Script on Another Server

Posted: Mon Sep 17, 2007 4:46 pm
by thepeel
I've seen similar questions asked before but they either do not fit my situation or went unanswered.

Basically we have a PHP script running on a server on our intranet that creates directories based on client name and job number. In an effort to simplify things for the account reps setting these up, I would like it to also add the same directories on our client site. I'm wondering what the best way to do this would be.

I'm envisioning it looking something like this (removing other functions of the script):

Computer A (Intranet) ->Run PHP Admin Script -> Calls script on Computer B and passes info to it -> Takes info creates new directories

Where I'm struggling is what sort of limitations I will have on the remote server to pass variables and have it run the script and create the directories.

I hope this made sense.

Thanks in advance,

-peel

Posted: Mon Sep 17, 2007 5:04 pm
by volka
You might be interested in rsync.
http://en.wikipedia.org/wiki/Rsync

Posted: Mon Sep 17, 2007 5:32 pm
by Zoxive
Another thing to look at would be SOAP.

Posted: Mon Sep 17, 2007 9:09 pm
by thepeel
Thanks for the replies. I hadn't thought about rsync but in the interest of keeping things simple I left out some of what was going on that would somewhat preclude rsync from working.

The server running the intranet also hosts our client file server. This is our collab server that everyone in the office works from. We are a creative firm so it is a huge drive and is filled with tons of files. So when we create a new project in our project management software, the script creates a new project folder for the specified client and then creates a series of subdirectories that help manage the project workflow. Our client web server on the remote machine is just for showing comps and letting the clients upload things. What I want to do is modify the part of the script that creates the directories on the local client share so it simply creates a project folder and a couple of comp folders on the client web site. So it would basically be the same script but it would be creating two different sets of directories. So in that scenario rsync wouldn't work.

The two Servers are setup something like this:

Intranet
Script
Client
Project
Images
Comps
Source
Illustrator
Etc.

Client Website
Script
Client
Project
Comps
Final
Uploads


I hadn't looked into SOAP and will probably spend a little more time messing around with getting my php idea to work before doing so. As you can tell I'm still a noob when it comes to php so learning something else right now isn't exactly on the radar.

So keeping in mind the above does anyone have a suggestion on how this would work using only php?

Thanks again,

-peel

Posted: Mon Sep 17, 2007 9:43 pm
by Christopher
There are many solutions. You could mount the client site's directory as a NFS share on you intranet server. You could use software like rsync or FTP. Or jsut make some kind of HTTP request to the client server to a remote script to create the directories. It could be as simple as a GET/POST, maybe using HTTP authentication. Or something fancy like SOAP.