Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter very long loading times under Xampp and Wamp server
#1

(This post was last modified: 06-22-2024, 02:02 AM by minsk832.)

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.
Reply
#2

Check if your baseURL is correct.
https://codeigniter.com/user_guide/insta...-site-uris
Reply
#3

(This post was last modified: 06-22-2024, 02:33 AM by minsk832.)

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.
Reply
#4

Okay.

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

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

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.
@xxxx[{::::::::::::::::::::::::::::::::>
Reply
#6

(This post was last modified: 06-22-2024, 02:59 AM by minsk832.)

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.
Reply
#7

(This post was last modified: 06-22-2024, 03:27 AM by InsiteFX. Edit Reason: spelling error )

Can you show us your view code?
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#8

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?
Reply
#9

> 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
@xxxx[{::::::::::::::::::::::::::::::::>
Reply
#10

Minify CSS Online

Minify JS Online

unminify
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB