How to reduce execution time in php
this is my script, it takes too long , how can I improve the execution time ? Show SEE THE ALL OF THE COD: HERE !
The variable and the query result always return me one value; asked Oct 15, 2014 at 7:46 6 Each time you're executing a SQL Query, no matter how many result it returns, it takes some time. The best you can do to decrease the time your script takes, is to put the query outside the loops, fetch all the results at once, and process it afterward with your loop. answered Oct 15, 2014 at 7:53
blue112blue112 48.6k3 gold badges45 silver badges54 bronze badges 2
First of all: don't use mysql_*. Anyway try to redo this with as few queries as possible. I don't have time to analyze all the intentions right now but try something like that:
answered Oct 15, 2014 at 8:08
Tomasz KapłońskiTomasz Kapłoński 1,2502 gold badges20 silver badges45 bronze badges 3 use associative array with key as the id_produs and its value after that inside loop use again associative array to fetch all records relevant to the first associative array hope it will decrease a little bit time. thankx answered Oct 15, 2014 at 8:57
(PHP 4, PHP 5, PHP 7, PHP 8) set_time_limit — Limits the maximum execution time Descriptionset_time_limit(int When called, set_time_limit() restarts the timeout counter from zero. In other words, if the
timeout is the default 30 seconds, and 25 seconds into script execution a call such as Parametersseconds The maximum execution time, in seconds. If set to zero, no time limit is imposed. Return Values Returns Notes
mba_aslam at yahoo dot com ¶ 15 years ago
(20); kexianbin at diyism dot com ¶ 8 years ago
my_timeout_exec($cmd, $stdin='', $timeout) jonathon dot keogh at gmail dot com ¶ 14 years ago
eric pecoraro at shepard com ¶ 17 years ago
if ( !function_exists('curl_setopt') OR !function_exists('curl_setopt') ) { Anonymous ¶ 2 years ago
robertbrogers at gmail dot com ¶ 8 years ago
php at mightycpa.com ¶ 19 years ago
f.nakamura ¶ 7 years ago
Daan ¶ 1 year ago
= 3;// This will make sure this is always called async rycardo74 at gmail dot com ¶ 16 years ago
date("H:m:s"),"\n";
ratty at brohoof dot com ¶ 10 years ago
rsallo at gna dot NOSPAM dot es ¶ 19 years ago
php at stock-consulting dot com ¶ 15 years ago
alexander dot krause at ed-solutions dot de ¶ 11 years ago
$pid) {
jatin at jatinchimote dot com ¶ 16 years ago
ravenswd at gmail dot com ¶ 13 years ago
agvozden at gmail dot com ¶ 11 years ago
bjfieldNO at SPAMgmail dot com ¶ 15 years ago
Silver_Knight ¶ 12 years ago
Cleverduck ¶ 16 years ago
BW ¶ 13 years ago
mingalevme at gmail dot com ¶ 10 years ago
$row = $stmt->fetchRow()) { How can we increase the execution time of a PHP script?Set Max_Execution_Time globally in php.. Locate and open your PHP build folder.. Find the php.ini file and open it.. Find the following line in the text configuration file – max_execution_time=30.. Change the value 30 to the value of choice, Remember, this value is in seconds.. Save & Close.. What is Max execution time PHP?By default, the maximum execution time for PHP scripts is set to 30 seconds. If a script runs for longer than 30 seconds, PHP stops the script and reports an error. You can control the amount of time PHP allows scripts to run by changing the max_execution_time directive in your php. ini file.
How do I fix PHP timeout?Set the max_execution_time in your PHP configuration file to the number of seconds that want to allow your PHP scripts to execute.. Open php. ini file using your favourite text editor. ... . Set the value for max_execution_time in seconds. max_execution_time = 300. ... . Restart your web server. $ sudo systemctl restart apache2.. Does PHP have a timeout?The default timeout is 30 seconds. It can be changed using the max_execution_time php.
|