[PHP] avoiding time out .. - Techist - Tech Forum

Go Back   Techist - Tech Forum > Computer Software > Programming
Click Here to Login
Closed Thread
 
Thread Tools Display Modes
 
Old 05-07-2012, 05:41 PM   #1 (permalink)
True Techie
 
Join Date: Jul 2009
Location: Syria
Posts: 147
Send a message via Yahoo to alaa_ecv_tc
Lightbulb [PHP] avoiding time out ..

Hi ..

While testing some codes in PHP and MySQL I had this :

There are 1 million posts where 'prefix' clumon for them all is set to 'add' .
total size of db is about 32Mb .
the runned code is :
SELECT * FROM 'posts' WHERE deleter_id = '0' AND prefix = 'add' ORDER BY id DESC LIMIT 25 OFFSET 900000 ;

In Phpmyadmin it took about 60.6 sec to show results ..

In my program I got that max time for operation is 20 secounds .. and died !!

How can I avoide that limit like phpmyadmin did ?


Thanks
__________________

__________________
♣ ♠ ♦
alaa_ecv_tc is offline  
Old 05-08-2012, 11:26 AM   #2 (permalink)
It's all just 1s and 0s
 
office politics's Avatar
 
Join Date: Jan 2004
Location: in the lab
Posts: 6,555
Send a message via MSN to office politics
Default Re: [PHP] avoiding time out ..

How to Temporarily Change the PHP Maximum Timeout | eHow.com
__________________

office politics is offline  
Old 05-08-2012, 01:47 PM   #3 (permalink)
True Techie
 
Join Date: Jul 2009
Location: Syria
Posts: 147
Send a message via Yahoo to alaa_ecv_tc
Default Re: [PHP] avoiding time out ..

Nice .thanks
__________________
♣ ♠ ♦
alaa_ecv_tc is offline  
Old 05-08-2012, 11:51 PM   #4 (permalink)

Triforcer
 
Baez's Avatar
 
Join Date: Sep 2005
Location: Toronto, Canada
Posts: 6,987
Default Re: [PHP] avoiding time out ..

Instead of increasing the timeout limit it would be better to figure out why your query is taking over a minute to execute in the first place. No query should take that long to display 25 rows of information from only one table. It sounds like a case of improper index use.
__________________


Baez is offline  
Old 05-09-2012, 06:57 AM   #5 (permalink)
True Techie
 
Join Date: Jul 2009
Location: Syria
Posts: 147
Send a message via Yahoo to alaa_ecv_tc
Default Re: [PHP] avoiding time out ..

yes it was .. and I fixed it and it is taking 6 sec ..
But I have more than 60,000 rows to insert/modify into db and make sure not to put the same row again and not deleting old data .. the only unique part of data is the work order number and it is 12 digits .. so it is really taking too long to process data on the 32bit server they have
__________________
♣ ♠ ♦
alaa_ecv_tc is offline  
Old 05-20-2012, 07:39 AM   #6 (permalink)
Newb Techie
 
Join Date: May 2012
Posts: 4
Default Re: [PHP] avoiding time out ..

Download the database, setup on your pc use the php.ini to increase the maximum execution time. Make the required changes to the database. Upload the modified the database again.
arifur is offline  
Old 05-21-2012, 07:28 AM   #7 (permalink)
True Techie
 
Join Date: Jul 2009
Location: Syria
Posts: 147
Send a message via Yahoo to alaa_ecv_tc
Default Re: [PHP] avoiding time out ..

Quote:
Originally Posted by arifur View Post
Download the database, setup on your pc use the php.ini to increase the maximum execution time. Make the required changes to the database. Upload the modified the database again.
That's not an option !
__________________

__________________
♣ ♠ ♦
alaa_ecv_tc is offline  
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[PHP] Time stamp alaa_ecv_tc Programming 5 04-03-2012 01:24 PM
[Help] How to make a PHP create a new PHP? Improvizionz Programming 1 02-12-2012 06:35 AM
PHP - Search for "X" in multiple PHP files Mathias Programming 1 09-13-2008 04:35 PM
Recruiting Php Scripters + Linux Consultants + Anyone that needs help with Php Murdoc SEO and Web Traffic 0 11-02-2005 08:05 PM
PHP to ASP (easy for you guys) <?php include to the correct ASP code? Jso Programming 2 08-08-2005 01:15 PM



Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -5. The time now is 10:18 AM.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.