TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Absolute Beginners (http://www.talkphp.com/absolute-beginners/)
-   -   Issues on php.ini (http://www.talkphp.com/absolute-beginners/2987-issues-php-ini.html)

Dave 06-21-2008 03:22 PM

Issues on php.ini
 
Hello to everyone --

I ran a PHP program the other day and got the "30" second server timeout error.

I looked about the internet for a solution, and found an advisory post where the author recommended changing the php.ini settings to a timeout to 120 seconds and upping the script memory from 8K to 256K.

I did this and the program ran as intended.

So, my question is, are there any repercussions for changing these settings? Or, is it just a willy-nilly, harmless thing like picking a shirt color?

Thanks,
Dave

Salathe 06-21-2008 04:10 PM

In most circumstances, in particular websites, you shouldn't want a script to be running for 30 seconds or longer. If a page took that long to load, chances are your visitors would have gone elsewhere way before 30 seconds elapsed but it's a good point to cut off further execution to prevent things running for a long time (for any number of reasons). The official reasoning (from the PHP Manual) would be that it "helps prevent poorly written scripts from tying up the server".

Rather than changing the php.ini settings, which will affect every PHP file, you can change the values just for the currently running script (unless running under 'safe mode') by using ini_set() (for max_execution_time and memory_limit).

Jim 06-21-2008 05:44 PM

You can also use the set_time_limit() function.

Dave 06-22-2008 08:40 PM

Thanks for the information
 
Salathe and Jim --

Thanks for your information. I'll switch to using the "extended server time" option within programs and change back the php.ini settings to their defaults.

See you next time,
Dave

Village Idiot 06-22-2008 09:15 PM

You dont want every script on your server to be able to run more than 30 seconds. In most cases it means something is wrong, in others it means a resource is taking too long. One way or another, it could easily get really taxing on your server, especially if someone plots an attack using it. Use ini_set() to set the particular scripts that need to run that long.

Dave 06-23-2008 02:56 AM

Thanks!^^

Actually, this is a -- don't know how to explain this -- sort of a desktop application (written in PHP) that I'm working on...My "localhost" server was giving me the timeout error...So, this is not a web app just yet.

Dave

unitechy 06-24-2008 06:25 AM

;-)
Quote:

Originally Posted by Dave (Post 15899)
Thanks!^^

Actually, this is a -- don't know how to explain this -- sort of a desktop application (written in PHP) that I'm working on...My "localhost" server was giving me the timeout error...So, this is not a web app just yet.

Dave

even if you are using it as "desktop app" you must have installed server on your desktop to do so!
so indirectly its an web app ;-)


All times are GMT. The time now is 08:23 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0