NYCPHP Meetup

[nycphp-talk] php script timeout not working

Rob Marscher rmarscher at beaffinitive.com
Sun Apr 5 18:51:44 EDT 2009


Corey,
Are you on a unix based machine?  Is that script really local?

Try
shell_exec('/path/to/s3uploader.php &');
instead of fopen.

The ampersand will get it to return without waiting for the upload  
script to finish.

On Apr 5, 2009, at 6:16 PM, Daniel Convissor <danielc at analysisandsolutions.com 
 > wrote:

> Hi Corey:
>
> On Sun, Apr 05, 2009 at 04:28:20PM -0400, Corey H Maass -  
> gelform.com wrote:
>>
>> set_time_limit(1);
>
> set_time_limit() works for your PHP code.  Streams, in a way, are  
> outside
> your PHP code.
>
>
>> $handle = fopen("http://localhost/s3uploader.php", "r");
>> stream_set_timeout($handle, 1);
>>
>> But neither timeout is working - it sits and spins while the upload
>> takes place. Any ideas?
>
> That's not working because you're opening and reading the file  
> directly.
> The timeout setting has no effect because you haven't gotten to that  
> line
> yet
>
> Two options.  Use fsockopen() instead of fopen(), see the
> stream_set_timeout() documentation for examples.  Or use
> ini_set('default_socket_timeout', 1) before you call fopen().
>
> --Dan
>
> -- 
> T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
>            data intensive web and database programming
>                http://www.AnalysisAndSolutions.com/
> 4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409
> _______________________________________________
> New York PHP User Group Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> http://www.nyphp.org/show_participation.php



More information about the talk mailing list