views:

745

answers:

8

Hi

I have created one sample php script to upload excel sheets of very bigger sizes. Also the process happening with each records given in the excel sheets is bit complex. To allow bigger sizes, I have added necessary php ini values in the apache configuration file to override the actual php ini values.

The problem is, once i upload the bigger files, it takes longer time say 2 mins or so, after that i am seeing the blank page instead of results page. When I tailed the apache logs, I didnt see any such lines related to this issue.

Just wanted to know, Is there any case/possibilities when apache could serves blank page?

But when I tailed my app level logs, it is very clear the script has completes the job perfectly. My suspect, May be what could have happen is, once the job completes, while apache about to serve back the results page something would have happened..but am not sure about it.

Can anyone please help me on this issue?

thanks, Mani

+2  A: 

My guess is that it's not Apache's fault and your browser just times out the connection. You could try some of these techniques and see if that helps any.

Kyle Cronin
+1  A: 

Is it possible than an "else"-case is not properly handled? You might assume the file was uploaded successfully, but that doesn't necessarily mean it did. Did you only increase the 'upload_max_filesize' or also the 'post_max_size' (the grand total of all your forms: input text + files)?

Try adding the following on the top of your script, to see any errors or warnings PHP might show.

error_reporting(E_ALL);
Mojah
you might want to also do ini_set('display_errors', true);
Tom Haigh
I am sure that the script has uploaded the file successfully and even it completes the tasks it supposed to do. Also I have overrided the post max size value in apache conf file. All the error flags has been turned on.
A: 

You can do two thing to avoid this problem

  1. Ask user to convert excel file into csv if possible in your situation. as csv are much lighter than excel sheet.
  2. try using header("newpage.php") in the script to redirect user to new page
Raj Kumar
The requirement is to allow the user to upload both csv and excel file.
A: 

If it's going to take some time to process a request/upload, you may want to consider creating a queue, where the user knows the file was successfully uploaded, and must just wait (can check status on a page perhaps); and you have a cronjob/background process to convert the file(s) and update them. This way it doesn't waste the users time at all.

DreamWerx
A: 

Sounds like a memory problem, try increasing memory_limit or optimizing your memory usage

Memory allocation/segfaults errors results on blank pages and no log information.

Slipo
Make sure your have display_errors=On on your php.ini to see the fatal error.
Slipo
A: 

Thanks for alternative ways to do the process. But I just want to know the reason for the problem - At what point of time, apache will serve blank page?

As Slipo said, it would have happened because of memory allocation/segmentation fault problems. If this is the case, is there a way to catch this exception?

thanks, Mani

A: 

Make sure your have display_errors=On on your php.ini to see the fatal error.

Slipo,

I think switching "on" display_errors will help us only to see the errors on the browser screen. It dont have any control on the types of errors.

Thanks, Mani

A: 

All, I am able to see the fatal error in the logs. Thanks.