set_time_limit alternatives?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
mrmille
Forum Newbie
Posts: 3
Joined: Fri Oct 15, 2004 6:17 am
Location: Linköping, Sweden
Contact:

set_time_limit alternatives?

Post by mrmille »

G'day!

I got a problem with a script that takes sometime to execute. Its a fileuploader. If i try to upload a small file it works fine but a larger file will make the script timeout.

Anyway
I got access to a server running in safemode (its a webhotell) and are now looking for some alternatives to set_time_limit(0);. Unfortenately i cant change the php.inf settings and either increase the default values or turn off safemode.

In asp i can set the timelimit like this
Server.ScriptTimeout = 60*100
This one is only relevant for the script OR function thats executed. Which means that i can use that timeout for a single function.

If there is no way to solve this i'd say that php i useless in filehandling situations :roll:

Please help!
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

safe mode is kinda the problem here, not PHP, if that was disabled you'd have no issue because you can just use [php_man]set_time_limit()[/php_man]:
PHP Manual wrote:Warning

set_time_limit() has no effect when PHP is running in safe mode. There is no workaround other than turning off safe mode or changing the time limit in the php.ini.
This is an issue with the host of the site, not with PHP itself ;) .

Mac
User avatar
mrmille
Forum Newbie
Posts: 3
Joined: Fri Oct 15, 2004 6:17 am
Location: Linköping, Sweden
Contact:

Post by mrmille »

That makes php a bit louse actually

damn
:(
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

mrmille wrote:That makes php a bit louse actually

damn
:(
No, that makes safe mode lousy. It's a pig to work with often and it's generally best to avoid servers which have it enabled to save yourself a bunch of hassle.

Mac
Post Reply