简体   繁体   中英

Functionality via Url Interface vs. Include

I have been working on a project which had been split over several servers and so php scripts had been run through a url interface. eg to resize an image I would call a script on one server either from the same or from one of the other servers as

file_get_contents('http://mysite.com/resizeimg.php?img=file.jpg&x=320&y=480');

now, this works but we are upgrading to a new server structure where the code can be on the same machine. So instead of all these wrapper functions I could just include and call a function. My question is: is it worth the overhead of rewriting the code to do this?

I do care about speed, but don't worry about security -- I already I have a password system and certain scripts only accept from certain ips. I also care about the overhead of rewriting code but cleaner more understandable code is also important. What are the trade offs that people see here and ultimately is it worth it to rewrite it?

EDIT: I think that I am going to rewrite it then to include the functions. Does anyone know if it is possible to include between several servers of the same domain? Like if there is a server farm where I have 2-3 servers can I have some basic functionality on one of them that the others can access but no one else could access from the outside?

is it worth the overhead of rewriting the code to do this?

Most likely yes - a HTTP call will always be slower (and more memory intensive) than directly embedding the generating library.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM