# Maximum execution time of 30 seconds exceeded

**URL:** <https://discourse.cakephp.org/t/maximum-execution-time-of-30-seconds-exceeded/9155>\
**Category:** Need Help\
**Created:** [March 22, 2021, 9:02pm UTC](https://discourse.cakephp.org/t/maximum-execution-time-of-30-seconds-exceeded/9155 "2021-03-22T21:02:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![makamo66](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/makamo66/32/2156_2.png) [@makamo66](https://discourse.cakephp.org/u/makamo66)\
**Post date:** [March 22, 2021, 9:02pm UTC](https://discourse.cakephp.org/t/maximum-execution-time-of-30-seconds-exceeded/9155/1 "2021-03-22T21:02:12Z")

</div>

I searched for solutions on the internet but they mostly said that this was caused by slow database queries, however my app is slow even when I disconnect from the database.

I could change the execution time by changing max\_execution\_time in my php.ini but I don’t want to give it more time; I want it to load more quickly. No one will want to re-visit my web site if the pages load that slowly.

One site said that it could be re-creating the cache for every request and that I should change the file permissions on the tmp and log folders but I don’t see why changing the permissions would have an effect on caching and I was only able to allow sharing on my Windows xampp system anyway.

---

<div class="post-metadata">

**Author:** ![Jawfin](https://avatars.discourse-cdn.com/v4/letter/j/dbc845/32.png) [@Jawfin](https://discourse.cakephp.org/u/Jawfin)\
**Post date:** [March 22, 2021, 10:36pm UTC](https://discourse.cakephp.org/t/maximum-execution-time-of-30-seconds-exceeded/9155/2 "2021-03-22T22:36:03Z")

</div>

Disclaimer: I am not a web developer (go figure) so I can’t provide any info based from experience.

Use the Chrome dev tools to analyse your page. Press F12 and go to Lighthouse (last tab) and generate a report : mobile/desktop.

The dev tools can also display CPU loading times, overlapping actions and bottlenecks. Also use the Performance tab and record the loading time - both full-load ‘Ctrl+Shift+R’ and refresh ‘F5’. Note ironically the refresh is more relevant as full load only happens maybe once a day - but still it’ll give clues.

Both the browser and CakePHP have significant caching, so you don’t always know what is doing what for you (static css js & images is your browser cache, repeated queries and static forms is cake).

It may simply be images which are bigger than need be, or trailing variables on GET which force ignoring the cache (which is handy at times \*cough\*Google KMZs\*cough\*).

Even the Network tab in dev tools, very handy for tracking slow AJAX, iFrame, etc.

Then, you should be able to complete the sentence; my web page is slow because of \_\_\_\_\_\_, how can I make that quicker? 🙂

Edit: If its slow before loading then use the CakePHP _debug_ and stick in debugs of function name + date\_time so you can see where in the PHP its stalling - specifically focus on before & after any preloaded queries.

---

<div class="post-metadata">

**Author:** ![makamo66](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/makamo66/32/2156_2.png) [@makamo66](https://discourse.cakephp.org/u/makamo66)\
**Post date:** [March 22, 2021, 10:52pm UTC](https://discourse.cakephp.org/t/maximum-execution-time-of-30-seconds-exceeded/9155/3 "2021-03-22T22:52:24Z")

</div>

I said that I disconnected the database and so I didn’t think it was related to that but on second thought I think it still executes the SQL queries even when I disconnect. I’m not sure.

---

<div class="post-metadata">

**Author:** ![makamo66](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/makamo66/32/2156_2.png) [@makamo66](https://discourse.cakephp.org/u/makamo66)\
**Post date:** [March 22, 2021, 11:18pm UTC](https://discourse.cakephp.org/t/maximum-execution-time-of-30-seconds-exceeded/9155/4 "2021-03-22T23:18:55Z")

</div>

Thanks, Jawfin. On my computer, pressing F12 turns on airplane mode. I selected Developer Tools in my Chrome browser but I didn’t see any of the tabs you mentioned. I’m going to read your post again later and see what I can understand. I’m not good at reading because I hear voices. I have a very low reading comprehension so I need to read and re-read.

---

<div class="post-metadata">

**Author:** ![Zuluru](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/zuluru/32/1230_2.png) [@Zuluru](https://discourse.cakephp.org/u/Zuluru)\
**Post date:** [March 23, 2021, 12:00am UTC](https://discourse.cakephp.org/t/maximum-execution-time-of-30-seconds-exceeded/9155/5 "2021-03-23T00:00:32Z")

</div>

The 30 second timeout wouldn’t likely be related to images or CSS or things like that loading slowly. It’s PHP that’s timing out, trying to do something. Is it all pages that do this, or just some? Does it matter if you’re logged in or not? If you create a very simple `x.php` in your webroot that just has `<?= 'Test';` in it, how long does that take to load?

---

<div class="post-metadata">

**Author:** ![Jawfin](https://avatars.discourse-cdn.com/v4/letter/j/dbc845/32.png) [@Jawfin](https://discourse.cakephp.org/u/Jawfin)\
**Post date:** [March 23, 2021, 2:16am UTC](https://discourse.cakephp.org/t/maximum-execution-time-of-30-seconds-exceeded/9155/6 "2021-03-23T02:16:08Z")

</div>

Yup 99% chance its in your PHP. May even have a dead-loop, or at least poorly optimised code. Put in echos as Zuluru says - and I like to put in timings, and comment out chunks of heavy code, slowly re-introduce so you can find the bottlenecks. In fact, as Zuluru said, start with nothing but `Hello World` and work your way up!

Also, politely, learn how your laptop works! I would guess you have a HP and it’s got a function override that hijacks your function keys (I hate those things!) so that F12 has been repurposed.

You can also do Google searches on other ways to open the dev tools, which lead me to this article [Chrome DevTools &nbsp;|&nbsp; Google Developers](https://developers.google.com/web/tools/chrome-devtools)  
because you will need a decent client-side debugger sooner or later!

---

<div class="post-metadata">

**Author:** ![makamo66](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/makamo66/32/2156_2.png) [@makamo66](https://discourse.cakephp.org/u/makamo66)\
**Post date:** [March 23, 2021, 2:17pm UTC](https://discourse.cakephp.org/t/maximum-execution-time-of-30-seconds-exceeded/9155/7 "2021-03-23T14:17:16Z")

</div>

Thanks for your replies, Zuluru and Jawfin.
