mridang_agarwal Posted June 7, 2007 Share Posted June 7, 2007 hey guys, I really need some help here. i've written a php script to download file using sockets. The file is a couple of hundred megs in size and the script is to run in the backgrond. I've added the line ignore_user_abort(1); set_time_limit(0); to my script. On my machine it runs file. The file take about an hour to download and i dont have any issues. When i uploaded the php file onto my server, it began executing, downloade about 5-10% of the file and then quit. What coupd be causing this problem? Can i check what is causing my script to abort/terminate? I host with powweb. Quote Link to comment https://forums.phpfreaks.com/topic/54647-php-script-aborts/ Share on other sites More sharing options...
per1os Posted June 7, 2007 Share Posted June 7, 2007 It could be the time_limit but it also could be the memory limit php sets. If you do not have access to php.ini to set that which I bet your host does not allow. You may be SOL, but I would look into this: http://www.radinks.com/upload/config.php The normal limit is about 16MBs Quote Link to comment https://forums.phpfreaks.com/topic/54647-php-script-aborts/#findComment-270235 Share on other sites More sharing options...
jscix Posted June 7, 2007 Share Posted June 7, 2007 http://us2.php.net/set_time_limit Quote Link to comment https://forums.phpfreaks.com/topic/54647-php-script-aborts/#findComment-270236 Share on other sites More sharing options...
mridang_agarwal Posted June 7, 2007 Author Share Posted June 7, 2007 well the moment you hear what i've got to say you might say "what a !@#$head". Well, my php script also consisted of a line ini_set("memory_limit", "1024M"); My script was based on the code of another script i found online. It had this line. I though it would have something to do with downloading a file so i let it be 1024M. Could it be the reason why it quits? Is there a way i can check if my script is crashing or it is being aborted? Quote Link to comment https://forums.phpfreaks.com/topic/54647-php-script-aborts/#findComment-270241 Share on other sites More sharing options...
per1os Posted June 7, 2007 Share Posted June 7, 2007 Don't get too upset, read his sig: I give faulty code on purpose; Don't be mad......... I'm lonely. Didn't think it was true till now lmfao. At anyrate, you may not have "full" access to the memory_limit or even the ini_set feature via your webhost. As far as telling if it is aborting or what not, there is no real way to tell. A good test would be upload a file that is 15mb's than upload one that is 17MB's see if it aborts on the either or. If it does not abort or quit on the 15 but does on the 17, it means your host disallows changing the memory_limit. About the only way I can really think of to test for this sort of thing. Quote Link to comment https://forums.phpfreaks.com/topic/54647-php-script-aborts/#findComment-270247 Share on other sites More sharing options...
mridang_agarwal Posted June 7, 2007 Author Share Posted June 7, 2007 hey frost. When you refer to memory limit you are referring to the amount of RAM allocated right? Okay, when i use sockets to download a file, i keep writing the contents to a file in 4kb chunks, does it still occupy memory? i guess 16M for a normal script is enough. my webhost allows us to customise out php.ini. I have options in my control panel. Another thing, how do i execute my script using the system() or exec() command. where is the PHP executable located, what parameters should i pass? I just want to try this- might just work. Quote Link to comment https://forums.phpfreaks.com/topic/54647-php-script-aborts/#findComment-270260 Share on other sites More sharing options...
per1os Posted June 7, 2007 Share Posted June 7, 2007 http://us.php.net/features.commandline run a phpinfo(); to find out where the php executable is. Quote Link to comment https://forums.phpfreaks.com/topic/54647-php-script-aborts/#findComment-270266 Share on other sites More sharing options...
mridang_agarwal Posted June 8, 2007 Author Share Posted June 8, 2007 hey frost. I dont think my script is aborting due to memory limitations. I tried downloading some files using cURL (150megs in size) and t hey all downloaded flawlessly. Am i missing something here? Aslo could someone give me a the code to execute a php script from the command line using the exec, system, passthru or one of those commands. I cant seem to figure it out. Quote Link to comment https://forums.phpfreaks.com/topic/54647-php-script-aborts/#findComment-270506 Share on other sites More sharing options...
per1os Posted June 8, 2007 Share Posted June 8, 2007 It should be something as simple as: <?php exec('php /directory/to/script/to/run.php'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/54647-php-script-aborts/#findComment-270737 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.