PHP Community Marketing Expert Question:

Download Job Interview Questions and Answers PDF

Explain how can we increase the execution time of a PHP script?

PHP Community Marketing Expert Interview Question
PHP Community Marketing Expert Interview Question

Answer:

☛ Default time allowed for the PHP scripts to execute is 30 secs mentioned in the php.ini file. The function used is set_time_limit(int sec). If the value passed is ‘0’, it takes unlimited time. It should be noted that if the default timer is set to 30 sec, and 20 sec is specified in set_time_limit(), the script will run for 45 seconds.
☛ This time can be increased by modifying the max_execution_time in secs. The time must be changed keeping the environment of the server. This is because modifying the execution time will affect all the sites hosted by the server.
☛ The script execution time can be increased by
☛ Using sleep() function in PHP script
☛ Using set_time_limit() function
☛ The default limit is 30 seconds. The time limit can be set to zero to impose no time limit to pause.

Download PHP Community Marketing Expert Interview Questions And Answers PDF

Previous QuestionNext Question
Explain how does one prevent the following Warning ‘Warning: Cannot modify header information – headers already sent’ and why does it occur in the first place?Explain what is meant by PEAR in PHP?