3

I have a table orders with 30000rows. I am using Linode Server with 2GB RAM

but when i executed my query using phpmyadmin it give me 504 Gatetimeout Error

SELECT * FROM `orders`

I don't understand what's is the problem? i am getting that error you can see the image below

enter image description here

Shahid Ahmad
  • 764
  • 1
  • 7
  • 15
  • what i am doing is that i am using laravel where for one of my reports i want to get all the orders using elequent but i am getting 504 Gateway error then i want to analyze that problem in more detail but when i executed that raw query in phpmyadmin it give me a 504 error . now i am clearly confused that why this thing is happening. – Shahid Ahmad Oct 25 '16 at 12:54
  • What is the average size of the records? I would try to make a query that would return, say, 1000 records. 30000 records are not a lot for a reasonable server. – FDavidov Oct 25 '16 at 13:26
  • There is zero cases when you could need all your 300 thousands records in your browser - even if you somehow manage to load them all, it would be impossible to view them all at once! so what you should do is getting only some of the records – maxpovver Oct 25 '16 at 18:44
  • Use the database you have to perform reporting. Databases were invented for such use. Loading 300 000 records in PHP is memory consuming. You were lucky that you hit the execution limit before your data reached PHP. If you are loading all orders to perform reporting in PHP - **you are doing it wrong**. Use your database for what it was meant to be used - to **manipulate** and **query** data. – Mjh Oct 26 '16 at 13:29
  • @Mjh can u suggest me any method please what i do that actually that is the project requirement to laod all data but now i don't understand what i do that ? – Shahid Ahmad Oct 27 '16 at 06:30
  • Possible duplicate of [Prevent nginx 504 Gateway timeout using PHP set\_time\_limit()](https://stackoverflow.com/questions/16002268/prevent-nginx-504-gateway-timeout-using-php-set-time-limit) – Stephan Weinhold Jun 16 '17 at 11:09

5 Answers5

2

Add the following line to the file /etc/nginx/nginx.conf in the http{} block:
fastcgi_read_timeout 360;

Restart nginx :
sudo service nginx restart

Yunnosch
  • 26,130
  • 9
  • 42
  • 54
Nam Sama
  • 375
  • 3
  • 6
  • 1
    While this code may solve the question, [including an explanation](//meta.stackexchange.com/q/114762) of how and why this solves the problem would really help to improve the quality of your post, and probably result in more up-votes. Remember that you are answering the question for readers in the future, not just the person asking now. Please [edit] your answer to add explanations and give an indication of what limitations and assumptions apply. – Yunnosch Aug 11 '21 at 07:50
0

504 Gateway Timeout error it appears in those cases when a server that hosts the website is unable to return to the set time limit HTTP-response.

As a solution to suit the increase in PHP max_execution_time parameter value

Ilya Yaremchuk
  • 2,007
  • 2
  • 19
  • 36
0

504 Gatetimeout is a HTTP Error not a database error. The database takes too long to collect your data. You probably have to increase max_execution_time in your php.ini

SevenOfNine
  • 630
  • 1
  • 6
  • 25
0

Get 30k records at ones - it isn't a good idea, any way, you need to check your sql server configuration, 30k records isn't enough to get over default timeout. B/w if u just change timeout in web server it does not affect you b/c browsers have a default timeout to. Probably mysqltuner can help you to find configuration error.

Urgotto
  • 863
  • 7
  • 6
0
nano /usr/share/phpMyAdmin/libraries/config.default.php

Add / edit:

$cfg['ExecTimeLimit'] = 1800000;

I hope you're gonna get rid of it.

סטנלי גרונן
  • 2,917
  • 23
  • 46
  • 68
feddy
  • 11