I'm running Zend server and ZF1 with db2 database. For some export, the queries take a very long time (>50 seconds) this causes a 408 timeout error. I'm looking for a solution to show a loading message on the client while running the SQL query. Any help is appreciated.
Loading message instead of timeout while executing a heavy query
419 Views Asked by Ayoub At
1
There are 1 best solutions below
Related Questions in PHP
- php Variable name must change in for loop
- register_shutdown_function is not getting called
- Query returning zero rows despite entries existing
- Retrieving *number* pages by page id
- Automatically closing tags in form input?
- How to resize images with PHP PARSE SDK
- how to send email from localhost using codeigniter?
- Mariadb max Error while sending QUERY packet PID
- Multiusers login redirect different page in php
- Imaginary folder when I use "DirectoryIterator" in PHP?
- CodeIgniter + XDebug: debug only working in the main controller, index() function
- PHP script timeout when I use sleep()
- posting javascript populated form to another php page
- AJAX PHP - Reload div after submit
- PHP : How can I check Array in array?
Related Questions in ZEND-FRAMEWORK-MVC
- Loading message instead of timeout while executing a heavy query
- What is the base directory for Zend ViewModel setTemplate?
- Load different config based on the result of a Service function in Zend Framework 2
- Zend File Transfer Adapter Http is breaking my AJAX response, why?
- What could be stopping the server for send a valid response?
- Error action short circuiting application module bootstrap code
- In Zend MVC, how do you pass a variable set int the controller, to a layout?
- How to run same lines in all controllers init() function?
- In Zend/MVC how do I set up the controllers and views for a sub-application or submodule?
- Zend Framework : Invalid contrller specified (error) ??? Help
- MVC : Dynamic action links in a view: where to put the business logic (zend2)
- ZF2 - Get controller name into layout/views
- configuration in Zend Framework
- How to access models in default module in Zend_Framework?
- I have array of plain PHP object that I want to use in conjunction with Zend_Paginator and partialLoop
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
You need to increase the maximum execution time allowed for php so that it can finish and not be terminated with 408 return code. Either locally for that script only: http://php.net/manual/en/function.set-time-limit.php or globally: http://php.net/manual/en/info.configuration.php#ini.max-execution-time
The simplest way to show loading progress is to have the long job executed with an AJAX request. Your main page should show the loading progress and fire a request to the export script with Javascript. When that export script finishes, the main page can show a success message.
If the export script creates something like a CSV file that needs to be downloaded, rather than send that CSV as the response body you can output it to a file on the server and then send a url of that file in the response. Your Javascript in the main page can show that url and prompt the user to download it in the success message.
Another way to do it is to build a job queue. This can be done using a queuing system or just using a table of jobs in the database. When the user requests an export, you create a new job. You need a process that runs on the server, as a cron job for example, that checks the table for all new jobs, and when there is one it runs the export and updates the status of the job. In your page you need to periodically, with Javascript or simply by reloading the page, check the status of your job and show a success message when it's completed. Again, if the export creates a file, the server process needs to write it and you include a link to download in the success message.