JLager Posted April 22, 2020 Share Posted April 22, 2020 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? Quote Link to comment https://forums.phpfreaks.com/topic/310631-php-timeout-issue/ Share on other sites More sharing options...
chhorn Posted April 22, 2020 Share Posted April 22, 2020 that really depends on your task and the data. Quote Link to comment https://forums.phpfreaks.com/topic/310631-php-timeout-issue/#findComment-1577105 Share on other sites More sharing options...
JLager Posted April 22, 2020 Author Share Posted April 22, 2020 Why would that matter? If you mean that it is easy and natural to load tables and charts via ajax, then I agree and understand. It is a report with 4 tables and 2 charts. Quote Link to comment https://forums.phpfreaks.com/topic/310631-php-timeout-issue/#findComment-1577106 Share on other sites More sharing options...
kicken Posted April 22, 2020 Share Posted April 22, 2020 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. Quote Link to comment https://forums.phpfreaks.com/topic/310631-php-timeout-issue/#findComment-1577115 Share on other sites More sharing options...
JLager Posted April 23, 2020 Author Share Posted April 23, 2020 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. Quote Link to comment https://forums.phpfreaks.com/topic/310631-php-timeout-issue/#findComment-1577132 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.