Score:-1

.htaccess makes WordPress Dashboard very very slow

cn flag

Today I suddenly find the WordPress Admin dashboard is very very slow. It takes about 60s or more to access the post list, plugin list, etc. Or will just show an time-out error.

I try the following methods:

  • Restart Apache service.
  • Restart server.
  • Change PHP.ini settings. Then restart the server.

But all not working. Finally I do the following steps:

  1. Rename .htaccess to .htaccess.backup.
  2. Then the dashboard is fast. But WP Rocket complains that it cannot access .htaccess. Note: Based on my test, after renaming .htaccess, I must access a page, then go to step 3 will solve the issue. If Skip step 2, then the speed will not change. It seems that by accessing the page, the .htaccess will be loaded to Apache.
  3. Rename .htaccess.backup to .htaccess.

Then the dashboard is still fast, though the contents of .htaccess has never been changed.

Why? I cannot understand why a rename of .htaccess temporarliy can solve the issue permanently, even if the .htaccess contents are actually not changed at all.

Update:

A follow-up update:

  1. The problem occurs since I try to install vBulletin in a subfolder of our website https://www.example.com/forums/
  2. When the problem occurs, all WordPress instances under the same domain, i.e., https://www.example.com, https://www.example.com/blogs/ and https://www.example.com/license/ are all very slow. However, WP instances under other domains(but in the same server) are NOT affected.
  3. After I backup and deleting the /forums/ subdirectory, the problem never occurs again.

Update2:

After one day of normal status, now the problem occurs again. And the only solution is to rename .htaccess to .htaccess.backup, access a page under the domain example.com, and then rename .htaccess back.

Update 3

I finally solve the problem. The detailed process is put at https://www.webmasterworld.com/apache/5088830.htm#msg5089206

Jaromanda X avatar
ru flag
did you restart after changing php.ini? what did you change in php.ini? perhaps that's what actually fixed your issue
alancc avatar
cn flag
@JaromandaX, yes, I restarted the server after changing the php.ini, but that does not work.
kz flag
Is the problem resolved? Or does it recur and you have to go through this "renaming" process again?! What is in your `.htaccess` file? Under a default WP install, `.htaccess` is not used (no directives apply) when accessing the WP Admin dashboard. Where is the "time-out error" coming from? The browser? PHP?
alancc avatar
cn flag
@MrWhite, resolved but still don't know the reason. See my update.
kz flag
The vBulletin installation should be entirely self contained in the `/forums` subdirectory, so it's still a mystery.... unless vBulletin is modifying the root `.htaccess` file for some reason?
alancc avatar
cn flag
@MrWhite, No. That's impossible. I make backup of .htaccess every week and I have compared it with the previous versions. No special changes except for those generated by WP Rocket. It has only be one day. I would like to observe for more time to see if there are any rules on this issue?
alancc avatar
cn flag
@MrWhite, after one-day OK status, now the problem occurs again. So I belive it is not directly related to the /forums/ folder, but to the .htaccess file.
alancc avatar
cn flag
@MrWhite, I solve the problem. It is caused by the PHP FPM limits. See my update for details. Thank you for your help and attention.
Score:1
cn flag

Thank you for all your help.

I finally solve the problem. This post PHP scripts suddenly load very slow on Apache gives me hints. So I check the error log of Apache and PHP FPM:

From Apache error log, I see one line of this:

[Mon Jun 26 20:10:43.367089 2023] [mpm_worker:error] server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting

From PHP FPM error log, I see many lines of this:

[28-Jun-2023 03:42:30] WARNING: [pool example_com] server reached max_children setting (5), consider raising it

So I increase the PHP FPM limits as below:

  • Max Request from 20 to 128
  • Max Children from 5 to 75.

Now the error does not appear any more. The dashboard is always very fast.

Explanations:

  1. The dashboard becomes slow when my PHP request is queued and wait for a completion of another one.
  2. When I rename .htaccess, it seems some existing PHP requests will be cancelled. And then when I rename it back, the dashboard will be fast since the request can be served immediately.
  3. The /forums/ and vBulletin just increase the number of PHP requests, which makes the waiting time longer or waiting more frequent. So when I remove them, it seems to "solve" the problem.
  4. The limits seems to be domain-specific, see the PHP FPM error log. The main domain example.com is mostly visited by external visitors, so it will have the problem while other domains are actually for test purpose, so no one will visit it and they are be affected by the problem severely.

Hope this will help others with similar issues. Thanks to all of you again!

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.