Search code examples
phpsqliteruntime-errorsql-delete

Timeout when trying to delete a record


The weirdest thing happened today. When I run this query:

DELETE FROM some_table WHERE id IN(5)

I get a 30 second timeout error in PHP. The same query runs without issues on my local development server, but when I move it to the production server, I get the timeout.

No sqlite error or anything like that, just "Fatal error: Maximum execution time of 30 seconds exceeded " :|

What could be the problem? Is there any way I could debug this at least?


Solution

  • In top of all my new codes I put this function

    ini_set('max_execution_time',60);
    

    reference .

    to debug my script execute time I use this

    $start = microtime(true);
    function execute(){global $start;$end = microtime(true);$time=number_format(($end - $start), 5);return$time;}
    //..... your code here 
    echo '<br><b>.'Page Loaded In 'execute().' Seconds<b/>';