Page 1 of 1
Remote Classes?
Posted: Fri Mar 09, 2007 7:43 am
by Kadanis
As I delve into OO, I was thinking about it in relation to the main app for the company I work for. Basically the app is spread over 5 servers. Each handling different stuff, but in some cases they all need to use the same classes. ErrorHandler, DirectoryManager e.t.c
Is it better to have a copy of these classes sat on the local file system for the scripts to use, or is it ok to use a URL in the require_once() function.
I know that PHP will let you use a URL, but I'm curious about it from a design point of view. Is it a good idea? or should I not touch it even with a 10 foot stick.
Thanks
Posted: Fri Mar 09, 2007 8:17 am
by feyd
While it's technically possible to use a remote page in require_once(), there is a performance advantage to having the files locally available. Plus you would need to either specially script in logic to handle the remote request unless PHP doesn't parse the file on the remote server.
Posted: Sun Mar 11, 2007 9:11 am
by Ollie Saunders
I recommend version control.
Have one server run a subversion server and then check it out somewhere for that same server to use as well as on all the other servers. If any files are changed you'll have to commit it and update on all the other servers though you could probably use a cron job to run svn update every x minutes/hours.
Posted: Sun Mar 11, 2007 11:50 am
by Kieran Huggins
cron + SVN -- what a great idea ole.. I love it!
[open bag, insert trick]
Posted: Sun Mar 11, 2007 1:27 pm
by Begby
Yet even a better method is to implement a post-commit hook using a python or other such script to publish the files to the server. This way if you make an update that needs to be published immediately, you don't have to wait for the scheduled cron job to run.
http://svnbook.red-bean.com/nightly/en/ ... eate.hooks
Posted: Sun Mar 11, 2007 10:36 pm
by Christopher
Either a post-commit hook, or better after a successful run of the test suite -- then I use rsync because it is so fast and easy.
Posted: Mon Mar 12, 2007 9:45 am
by Kadanis
Wow, thanks again for all the replies. Some of it went a little over my head, so I think some serious reading is on the horizon.
I'll investigate the suggestions you made and have a go on the test system.
