I am facing an issue with uploading an excel data sheet. The functionality is like

  1. User uploads an excel sheet
  2. Records are inserted into that custom component's tables by which graphs are shown in front-end. The tables contains all the calculation values for different years.
  3. Then, for those records categories and articles are created.

But this works fine for small data sheets containing nearly 200 rows. Sometimes, step (2) works and it gets stuck in step (3). And sometimes, nothing works. When a sheet consists of more than 2000 rows then, half data is inserted and it gives me this error:

Gateway Timeout - 504 error

I am using phpexcel for uploading excel to database and tried setting the following in the controller's upload task but still it is not working.

ini_set('display_errors', 1);
ini_set('max_execution_time', 1800); //also tried set_time_limit(0);
ini_set('memory_limit', '-1');

Kindly, guide to any solution

  • The question at: stackoverflow.com/q/11629945/1983389 might help Aug 30, 2016 at 0:18
  • @NeilRobertson thanks for your response but I am using apache server. it's about nginx. I contacted the administrator and he has already increased the time on server as well but still facing this timeout.
    – Liz.
    Aug 30, 2016 at 6:45
  • Hi @Lisa, just suggesting it may be a server setting that needs to be updated rather than something that you can control via php.ini etc. Aug 30, 2016 at 10:57
  • 1
    i crosschecked with the server guy and he said he has already increased the time on server :/
    – Liz.
    Aug 30, 2016 at 12:53

2 Answers 2


Maybe look at other PHP values like max_input_time or some of the other suggestions in http://php.net/manual/en/features.file-upload.common-pitfalls.php

max_input_time sets the maximum time, in seconds, the script is allowed to receive input; this includes file uploads. For large or multiple files, or users on slower connections, the default of 60 seconds may be exceeded.


Sounds like it is one of two things.

1) Hosting server does not have enough resources and you require and upgrade

2) Php.ini is usually the culprit but it seems you have addressed that.

  • i have already increased the timeout in the server
    – Liz.
    Aug 30, 2016 at 6:53
  • and what of your hosting..that is usually the only other reason. Not enough resources. Sep 3, 2016 at 12:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.