Is there any limit to execute any PHP script?


#1

Hello,

Is there any limit on DH servers to execute the PHP script? I mean to say time limit?

I am facing strange problem. I have a PHP script which does some database interaction and does some modification on my blog system. that script might go long till 4-5 minutes or so.

I noticed while starting the service with DH, i was able to execute the script fully without breaking in between.

But from few last days, the script I execute, automatically stops executing after 1 minute!!! Wiered problem, but yes, and I think somebody must have made some change so that this happens. Even if you wish to test, you can do some PHP script which waits for 1 second and put that code in 10 loops…

If this problem can be solved, it seem to me that it can be solved only from server side. If here we have anybody from DH staff, I can provide more details to test and troubleshoot !! Let me know if this is done intentionally, and I expect legitimate reason for this too if thats true.

Thanks,

Jigar Mehta
India


#2

You do realize, you can just customize your own php install that has a greater execution time limit?
These are the PHP defaults:

So if you need something longer, then I would suggest checking the wiki on how to setup your own Php install so that you can modify those values to something higher:

Advanced PHP Configuration
Installing PHP5


#3

[quote]
Advanced PHP Configuration
Installing PHP5[/quote]
Linked below is another wiki article worth looking at, especially if you don’t want to go through the process of compiling your own PHP executable.

http://www.wiki.dreamhost.com/index.php/PHP.ini

This article explains how to copy the existing DreamHost installed PHP executable (either PHP4 or PHP5) to your domain and configure things so that it gets used.

Mark


Save [color=#CC0000]$50[/color] on DreamHost plans using [color=#CC0000]PRICESLASH[/color] promo code (Click for DreamHost promo code details)


#4

I think it makes sense to me what you guys are saying.

Initially i was using the webserver’s PHP and at that time, i was able to run full script of 4 minutes without any break. Then I compiled my own PHP using one of the wiki article and deployed it to increase the larger file upload facility. After that, I think i have not changed the execution time (i am using PHP 4.2). I just changed the ini file and replaced it to my PHP folder.

Should I do something so that those new INI settings gets into effect? any kind of command for that?

Thanks for your help guys.

Jigar Mehta
India


#5

The changes should take affect just as soon as you modify and save the php.ini file (so instantly) :wink:


#6

If you dont want to make any changes in the php.ini file,
just put this at the begining of your long execution time file:
set_time_limit(0);


#7

Hello,

I tried updating the minutes to 3000 instead of 30, just to test it… and i am running my script now, but its still getting terminated after 1 minute !! Really strange ! Any other way to workaround this one?

Jigar Mehta
India


#8

Hey man,

you made my day… adding this line in my code seems solving my problem.

thx man.

Jigar Mehta
India