1

I have a total of 2000 rows in my csv file. I noticed that it stops the upload around 280-300. I am using Laravel for my application.

I am using fgetcsv() and my code is like this.

if (($handle = fopen($destinationPath . $filename, "r")) !== FALSE) {
          while (($data = fgetcsv($handle, 3000, ",")) !== FALSE)  {           
           if($row == 1){ $row++; continue; }
           }
        }

Inside the while loop has a lot of conditional statements, insert query and update query.

What causes this bug? In my localhost, it is properly working, but in my server it isn't. Here's the specs of my shared hosting:

Server

What should be the solution for this? Thanks.

UPDATE: I tried adding the set_time_limit(0); then tried uploading the csv. Then I tried to use stopwatch and it exactly stops at 00:02:03.02 . That means it stops around 2 minutes.

3
  • Are you getting an error? that should tell you what the problem is. Commented Apr 3, 2018 at 2:56
  • I get redirected to my error 404 page. Hold on, I will try to activate the debug mode. Commented Apr 3, 2018 at 3:05
  • Try set_time_limit(0) at the top of your script for testing only if that works set it to some safe value equal to time you can guess for csv processing Commented Apr 3, 2018 at 3:39

1 Answer 1

1

Your php.ini settings looks fine. It is probably because of the your web server's(nginx, apache, litespeed etc.) settings.

If it is nginx, increasing the "fastcgi_read_timeout" will fix your issue. As it is a shared server I think you need to contact your hosting provider.

ps: this message suits for a comment but I am not privileged for posting a comment.

Sign up to request clarification or add additional context in comments.

1 Comment

Don't try to get around the reputation restrictions by posting comments as answers. Once you have sufficient reputation, you can post comments.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.