user3788648
user3788648

Reputation: 31

3 questions about set_time_limit() function in PHP

I have 3 Questions about set_time_limit() function in PHP :

  1. when a user doesn't have permission to access PHP.ini can he change the value of the set_time_limit() function ?
  2. what can I do to stop restarting set_time_limit() function ?
  3. other way: I don't want to run set_time_limit(). What can I do?

Upvotes: 0

Views: 868

Answers (2)

Rangad
Rangad

Reputation: 2150

To 1:

Yes a user may call the function even if they don't have access to the php.ini. You may use safe_mode(DEPRECATED and REMOVED in 5.4) or the disabled_functions ini directive to avoid this. However, set_time_limit is potentional misleading (read below). If you don't want to change the php.ini it might in a web context be possible to set the max response-time at the server level or the used cgi config.

To 2 also answers 3: Disallow the function and/or set max_execution_time.

Note: set_time_limit counts the execution time of the current running php script, not the time the script spends waiting on external ressources (Exception ofcourse on windows).

Upvotes: 1

Jorge Campos
Jorge Campos

Reputation: 23361

Your three questions is easily answered by the PHP Manual - set_time_limit function of set_time_limit function.

1 - A user only don't have permissions to change the php.ini when it doesn't have the permissions to do so through the file system

2 and 3 - You can change the max_execution_time on php.ini if you have the right permissions. Put on it a huge value (it is not recommended though)

Upvotes: 1

Related Questions