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
425 views Asked by Ayoub At
1
There are 1 answers
Related Questions in PHP
- How to add the dynamic new rows from my registration form in my database?
- Issue in payment form gateway
- How to create a facet for WP gridbuilder that displays both parent and child custom fields?
- Function in anonymous Laravel Blade component
- How to change woocomerce or full wordpress currency with value from USD to AUD
- General questions about creating a custom theme Moodle CMS
- How to add logging to an abstract class in php
- error 500 on IIS FastCGI but no clue despite multiple error loggings activated
- Composer installation fails and reverts ./composer.json and ./composer.lock to original content
- How to isolate PHP apps from each other on a local machine(Windows or Linux)?
- Laravel: Using belongsToMany relationship with MongoDB
- window.location.href redirects but is causing problems on the webpage
- Key provided is shorter than 256 bits, only 64 bits provided
- Laravel's whereBetween method not working with two timestamps
- Implementing UUID as primary key in Laravel intermediate table
Related Questions in ZEND-FRAMEWORK-MVC
- Zend Framework 1.2 - Error Table doesn't exists - even though the table already exists in MySQL
- Laminas: Different Layout Files for each Module
- How to pass variables from controller to layout (not view) in Zend 3
- Loading Modules Dynamically in Zend Framework 2
- tablegateway in Zend3 vs Model in Zend1
- Passing variables between Middlewares using zend-mvc
- Ignoring the default 404 route in ZF3 MVC
- What's the best way to make a ZF3 application with no default router?
- Can I have a ZF3 MVC Framework Controller with parameters in the constructor?
- How do I configure the default ZendLog factory for a Zend Framework MVC app?
- Making a Zend Framework 3 MVC app return a simple string
- Zend Project architecture
- ServiceManager in ZF3
- Serializing objects to ZF3 MVC Response JSON
- zf2 routing seems to ignore __NAMESPACE__
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?
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)
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.