php.ini & ini_set();

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

csfolch
Forum Newbie
Posts: 8
Joined: Wed Jul 12, 2006 2:08 am

php.ini & ini_set();

Post by csfolch »

Hi everybody.
I am trying to change the "max_execution_time" directive using the ini_set() function, but the change only is only applied in the browser's window where I execute my code. For example if i open a pop up and I use ini_get() it returns the default value.I know that ini_set() changes are only applied while the script with the function is running so after the change I use the sleep() function to keep running the script.

Anyone knows how can I use ini_set() to keep the changes until the end of the session or until I close the browser?.

Is there another way to change the "max_execution_time" or something similar at runtime? I tried to change window's registry but by default the first place where de system looks for the php.ini file is defined in the apache's configuration.
Thanks.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Do you have access to the php.ini? You can change it there if you do. Otherwise, you are going to have to use ini_set() to change it every page load. I think, I am not totally sure.
csfolch
Forum Newbie
Posts: 8
Joined: Wed Jul 12, 2006 2:08 am

Post by csfolch »

That is the problem. The files are inside a CD and we recorded 1000, but now there is a database query that expends more than the default time in old computers. So we are trying to write a "patch" to solve it.

Thanks.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

So your app runs a query that tops off the 30 second default 'max_execution_time'? Can you modify the query at all to optimize it?
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post by dull1554 »

why cant you just call

Code: Select all

set_time_limit (0);//sets timeout to infinity
in the script that performs the query.
csfolch
Forum Newbie
Posts: 8
Joined: Wed Jul 12, 2006 2:08 am

Post by csfolch »

No I can´t. I was trying to create a new .php that runs the ini_set() in a popup and after that runs the cd application while the popup waits with sleep() .
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post by dull1554 »

im pretty sure your out of luck, ini_set changes the settings but its on a per application setting not server wide, and this is the case with set_time_limit (0); also.
csfolch
Forum Newbie
Posts: 8
Joined: Wed Jul 12, 2006 2:08 am

Post by csfolch »

What about frames? Create a frameset with a frame (height=0 and width=0) with the ini_set() and the other with the application?
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post by dull1554 »

that wouldnt work either, because with a frameset you are still running more then one application, each page is its own entity, its just displayed together
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post by dull1554 »

unless you can directly modify the script thats beinbg run i dont see any simple fix for this
bdlang
Forum Contributor
Posts: 395
Joined: Tue May 16, 2006 8:46 pm
Location: Ventura, CA US

Post by bdlang »

Are you using Apache? Set the value of max_execution_time in an .htaccess file, and it's available to all scripts.
csfolch
Forum Newbie
Posts: 8
Joined: Wed Jul 12, 2006 2:08 am

Post by csfolch »

no the server is not apache (i think) I use an application called microweb that run php from cd without a server (well i suppose it has one inside).
User avatar
R4000
Forum Contributor
Posts: 168
Joined: Wed Mar 08, 2006 12:50 pm
Location: Cambridge, United Kingdom

Post by R4000 »

well i know microweb very well.... its crap tho :P

but, you can change php.ini on microweb methinks :)
csfolch
Forum Newbie
Posts: 8
Joined: Wed Jul 12, 2006 2:08 am

Post by csfolch »

Yes, but the cds have been recorded 1 month ago.
User avatar
julian_lp
Forum Contributor
Posts: 121
Joined: Sun Jul 09, 2006 1:00 am
Location: la plata - argentina

Post by julian_lp »

csfolch wrote:Yes, but the cds have been recorded 1 month ago.
It's sad to say, but maybe you should re-burn the entire cd-set shouldn't you?-
Post Reply