Jump to content

PHP Timeout issue


JLager

Recommended Posts

Hi,

 

I have a heavy php page that is timing out at 30 seconds. I do not have access to change/set any ini or max_execution_time or the like. I need to find some creative workaround. First, I looked at async calls, but I'm using Yii 1.1 at the moment and it didn't look like simple to implement when I had a quick glance at that. Is it possible to load the content via ajax instead?

Link to comment
Share on other sites

The type of data your processing and how you are loading that data can make a huge impact on the runtime of your scripts.  For example if you're querying a database you might be running hundreds or thousands of queries when instead you could run one or two.  You might be looping over your result set many times to apply different actions when maybe a little refactoring could do the same in one or two loops. 

30 seconds is a long time so either your processing a large amount of data or your code is very inefficient.  Breaking up the task across ajax calls may be possible, but you should make sure your PHP code is as efficient as it can be first.

 

Link to comment
Share on other sites

Thanks for your input. It is a heavy calculation, and not inefficent db calls, that is causing the load. The script is rather optimized as it is, not perfect, but I don't think I can make up many seconds by going over it once more. I'll try that first though, and then look at ajax.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.