CodeIgniter Forums
CodeIgniter very long loading times under Xampp and Wamp server - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: CodeIgniter very long loading times under Xampp and Wamp server (/showthread.php?tid=91144)



CodeIgniter very long loading times under Xampp and Wamp server - minsk832 - 06-22-2024

Hello, I've recently been having very long loading times for my CodeIgniter pages. Even without database queries, it takes > 16 seconds to load a simple view. PHP memory_limit etc. is set to > 4 GB. I also have the problem with both Xampp and Wamp Server (Xampp currently installed). I'm slowly running out of ideas as to what else could be causing it. Do you have any ideas?

Quote:Bootstrap: 23.83 ms
Required Before Filters: 3.39 ms
Routing: 1.45 ms
Before Filters: 0.04 ms
Controller: 16,271.44 ms
> Controller Constructor: 2.69 ms
> View: sites/privacy.php: 16,265.88 ms
> View: layouts/main.php: 8,148.69 ms

I don't have any filters or anything like that active. Controller is very simple:

PHP Code:
public function privacy()
 {
    echo view('sites/privacy');


View contains simple html (static).

If I write a PHP script that performs certain database queries, it runs in a few milliseconds also local.

The site is extremely fast on the live system (Ubuntu server). So it must be something local. But I don't know what else I can check.


RE: CodeIgniter very long loading times under Xampp and Wamp server - kenjis - 06-22-2024

Check if your baseURL is correct.
https://codeigniter.com/user_guide/installation/running.html#configure-for-your-site-uris


RE: CodeIgniter very long loading times under Xampp and Wamp server - minsk832 - 06-22-2024

Yes, I have configured the baseURL to a different one by .env with trailing slash:

app.baseURL = 'http://website.intern/'

It also makes no difference if I set app/Config/App.php public string $baseURL to the Dev Base URL as well. Because the .env has priority. I tested it anyway.

php spark phpini:check is also fine. I use CodeIgniter v4.5.2.


RE: CodeIgniter very long loading times under Xampp and Wamp server - kenjis - 06-22-2024

Okay.

> View: sites/privacy.php: 16,265.88 ms

The rendering of the view file took long time.
Check the contents.


RE: CodeIgniter very long loading times under Xampp and Wamp server - warcooft - 06-22-2024

You can try turning on development mode, then on the toolbar make sure Hot Reload is not active.

I once experienced something similar and it turned out that was the cause.


RE: CodeIgniter very long loading times under Xampp and Wamp server - minsk832 - 06-22-2024

Hello everyone! Thanks for your answers! Hot reload is disabled. I don't see any errors in xampp/apache/logs/error.log.

Even if I write the following in the view:

Code:
<h1>Test</h1>
<p>Hello World!</p>

I still get 8.14 seconds loading time for this view. I just don't understand it. Hard drive is a fast SSD.


RE: CodeIgniter very long loading times under Xampp and Wamp server - InsiteFX - 06-22-2024

Can you show us your view code?


RE: CodeIgniter very long loading times under Xampp and Wamp server - minsk832 - 06-22-2024

As a test, I had set the view code to

Code:
<h1>Test</h1>
<p>Hello World!</p>

So only this static HTML. Still > 8.4 seconds.

I just tested whether this was the case with a brand new version of CodeIgniter. And found out: No. It is incredibly fast, as you would expect.

So I went and recreated the whole project and copied the relevant data controllers, models, views, etc. over. Only replaced the adjusted config files.

The only thing I didn't restore was: https://github.com/mihatorikei/codeigniter-vitejs

So I suspect it had something to do with it. Do you have any recommendations, perhaps outside of Vite, on how to ideally reduce JS and CSS size?


RE: CodeIgniter very long loading times under Xampp and Wamp server - warcooft - 06-22-2024

> Do you have any recommendations, perhaps outside of Vite, on how to ideally reduce JS and CSS size?

This question should be on stackoverflow.

or you can try the following package https://github.com/michalsn/minifier


RE: CodeIgniter very long loading times under Xampp and Wamp server - InsiteFX - 06-22-2024

Minify CSS Online

Minify JS Online

unminify