Page 1 of 2
php.ini & ini_set();
Posted: Wed Jul 12, 2006 12:47 pm
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.
Posted: Wed Jul 12, 2006 12:51 pm
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.
Posted: Wed Jul 12, 2006 12:55 pm
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.
Posted: Wed Jul 12, 2006 1:10 pm
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?
Posted: Wed Jul 12, 2006 1:15 pm
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.
Posted: Wed Jul 12, 2006 1:16 pm
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() .
Posted: Wed Jul 12, 2006 1:17 pm
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.
Posted: Wed Jul 12, 2006 1:23 pm
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?
Posted: Wed Jul 12, 2006 1:26 pm
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
Posted: Wed Jul 12, 2006 1:28 pm
by dull1554
unless you can directly modify the script thats beinbg run i dont see any simple fix for this
Posted: Wed Jul 12, 2006 1:55 pm
by bdlang
Are you using Apache? Set the value of
max_execution_time in an .htaccess file, and it's available to all scripts.
Posted: Wed Jul 12, 2006 1:57 pm
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).
Posted: Wed Jul 12, 2006 2:39 pm
by R4000
well i know microweb very well.... its crap tho
but, you can change php.ini on microweb methinks

Posted: Wed Jul 12, 2006 2:47 pm
by csfolch
Yes, but the cds have been recorded 1 month ago.
Posted: Wed Jul 12, 2006 2:53 pm
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?-