Re: [PHP] moving file from one server to another
On Sat, September 30, 2006 4:29 am, Nick Wilson wrote: i have thttpd (a very light weight http server) running as an image server on one box, and users uploading images to another php/apache powered box. I need to let users upload to the regular LAMP box, but then copy the image over to the custom image server (which does not have php or any kind of cgi capability). I was considering using exec() and scp to do this, but thought i'd ask and see if anyone had any better suggestions? rsync Or do the images on the LAMP box go away? I'll bet that there's a configuration of rsync for that anyway, come to think of it. If rsync is out, the difference between an immediate exec('scp') in PHP and an every-minute cron job is probably going to be moot, for most users, in most real-world scenarios, if you handle it right. Provide the user with some nice eye candy in between that will distract them from the fact that it takes 62 seconds for their photo to show up... For most of them, by the time they finish the upload and click on to the next page to view it, they've already burned 10 to 20 seconds anyway... Or, better yet, just take the upload, and then let them move on to whatever else they want to do, without giving them that immediate view of the photo. If you work at it, a good Usability can be achieved without the scp, almost for sure. You just have to keep the user informed of the status, so they know what's going on, and update that cleanly, so they are kept current on the status -- all without compromising security, nor over-loading the server with requests. A simple status indicator on your masthead/navbar of recent uploads -- 3 uploads in process or all uploads processed is all you really need for this kind of app. Don't go all AJAXy and start burning up HTTP connections just to give them instant feedback -- They really don't care so long as: 1) They're kept informed as they do their tasks 2) They can force it to check if they've nothing better to do 3) The thing works fast and efficiently enough to be nice Start off with Your photo has been uploaded and is being transerred to our super-fast photo servers. We'll keep you posted in your status bar, and you can just keep on working. after the upload. Honestly, I like to double-check the uploaded images, but not if it's gonna take THAT long while you dink around scp-ing them or whatever. Let me do something *else* while you're doing that, and I'll check on them later. Thanks. :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] moving file from one server to another
On Sat, September 30, 2006 5:25 am, Nick Wilson wrote: yes. i'd considered rsync but the file needs to be available on the image server immediately. scp'ing it should work, but of course imnow having fun with the apache user and try9ing to work out how to give it an ssh profile :) Here's your first problem. There *IS* no such thing as immediately in this world. It's a nonsense word in this context. How much time do you REALLY have here as a constraint? Re-think this carefully, because any answer that doesn't provide at least a few seconds is just plain Wrong. :-) Now, once you've got immediately out of your head, ponder whether or not the user really wants to sit around, even for a few extra seconds, while *YOU* dink around with this scp stuff. I don't. Would you? Of course not! The user wants to upload the file, and then use those seconds to do something else useful, instead of watching your locked-up web application do nothing that is useful to them. If that LAMP/thttp connection gets slogged by a lot of uploads, the LAST thing you want is all your users sitting around *waiting* on that task which is, by definition, out-of-band with what the user wants to do. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] moving file from one server to another
hi, i have thttpd (a very light weight http server) running as an image server on one box, and users uploading images to another php/apache powered box. I need to let users upload to the regular LAMP box, but then copy the image over to the custom image server (which does not have php or any kind of cgi capability). I was considering using exec() and scp to do this, but thought i'd ask and see if anyone had any better suggestions? many thanks -- Nick Wilson http://performancing.com/user/1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] moving file from one server to another
On 30 Sep 2006, at 03:29 , Nick Wilson wrote: I need to let users upload to the regular LAMP box, but then copy the image over to the custom image server (which does not have php or any kind of cgi capability). I was considering using exec() and scp to do this, but thought i'd ask and see if anyone had any better suggestions? Ah... well, does the copy need to be interactive, or does it need to be automatic? I'd probably use rsync to copy the upload tree to the image server myself, without involving php at all. -- Three tomatoes are walking down the street- a poppa tomato, a momma tomato, and a little baby tomato. Baby tomato starts lagging behind. Poppa tomato gets angry, goes over to the baby tomato, and smooshes him, Catch up. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] moving file from one server to another
* and then Google Kreme declared On 30 Sep 2006, at 03:29 , Nick Wilson wrote: I need to let users upload to the regular LAMP box, but then copy the image over to the custom image server (which does not have php or any kind of cgi capability). I was considering using exec() and scp to do this, but thought i'd ask and see if anyone had any better suggestions? Ah... well, does the copy need to be interactive, or does it need to be automatic? I'd probably use rsync to copy the upload tree to the image server myself, without involving php at all. yes. i'd considered rsync but the file needs to be available on the image server immediately. scp'ing it should work, but of course imnow having fun with the apache user and try9ing to work out how to give it an ssh profile :) -- Nick Wilson http://performancing.com/user/1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] moving file from one server to another
How about nfs mounting a directory from the image server to a directory on the lamp server. This way, the files are never really on the LAMP server... td On 9/30/06, Nick Wilson [EMAIL PROTECTED] wrote: * and then Google Kreme declared On 30 Sep 2006, at 03:29 , Nick Wilson wrote: I need to let users upload to the regular LAMP box, but then copy the image over to the custom image server (which does not have php or any kind of cgi capability). I was considering using exec() and scp to do this, but thought i'd ask and see if anyone had any better suggestions? Ah... well, does the copy need to be interactive, or does it need to be automatic? I'd probably use rsync to copy the upload tree to the image server myself, without involving php at all. yes. i'd considered rsync but the file needs to be available on the image server immediately. scp'ing it should work, but of course imnow having fun with the apache user and try9ing to work out how to give it an ssh profile :) -- Nick Wilson http://performancing.com/user/1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Publish technical articles @ skilledwords.com and get 100% of the ad-revenue! http://www.skilledwords.com
Re: [PHP] moving file from one server to another
* and then Tony Di Croce declared How about nfs mounting a directory from the image server to a directory on the lamp server. This way, the files are never really on the LAMP server... yeh, that had ocurred to me, and may be a good solution Tony. The only thing that worried me was not knowing (ie having to research..) whether that would cause any significant overhead on the image server. It's not like it's an under spec'd machine, but the point of course is to have as small a server load as possible -- so we dont need to start dropping aditioonal boxes in too soon. I run nfs at home and we make good use of it on the local network where the actual application is for shared files under the laod balancer, but this would be another data center entirely. It may be that it's a trivial thing, the reason ive not done it is Im just not 100% sure on it is all, whereas simply scp/sftp'ing files into the image server dir is about as simple as it gets right? -- Nick Wilson http://performancing.com/user/1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php