• Resolved alainmelsens

    (@alainmelsens)


    Hello,
    I want to use the new APCu object cache setting, but the SQLite plugin does not show that it was turned on before. The “Use APCu” checkbox is off each time and each time a new define( ‘WP_SQLITE_OBJECT_CACHE_APCU’, true ); is added to the top of the wp-config.php file.
    I am using Windows IIS web server platform.
    The APCu php.ini settings do appear correctly.
    What is the reason for this?
    Thanks in advance.
    Best regards.

Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Author OllieJones

    (@olliejones)

    Thanks for the bug report. I haven’t had a chance to test APCu on Windows / IIS (or Windows / Apache). It sounds like I need to do that. Thanks for your patience.

    You *could* try editing wp-config.php directly to insert the

    define( ‘WP_SQLITE_OBJECT_CACHE_APCU’, true );

    line. It also may be necessary to restart your IIS server after making that change.

    Thread Starter alainmelsens

    (@alainmelsens)

    Hello,
    Thank you for your quick reply.
    I tested this your way and this also does not change anything. The ‘Use APCu’ box remains empty or so not indicated. Even after restarting the IIS.
    However, your SQLite plugin does notice very clearly that my system does support or use APCu.
    At the top, this is also indicated as:
    “You are using php’s APCu User Cache to improve the performance of this SQLite Object Cache. To disable APCu caching please uncheck the ‘Use APCu’ box.”
    On the other hand, is the Key Salt “define(‘WP_CACHE_KEY_SALT’, ‘….’);” in the wp-config.php file also a required one?
    If I add a Key Salt to the wp-config.php file, ‘Use APCu’ remains indicated, but then I can’t turn it off either. Because sometimes it is necessary for the correct functioning of other plugins such as, in my case, the FastDup plugin to take Backups. This does not work properly with ‘Use APCu’ on in the SQLite plugin.
    Pretty complicated, as far as it seems.

    • This reply was modified 1 year, 1 month ago by alainmelsens.
    • This reply was modified 1 year, 1 month ago by alainmelsens.
    • This reply was modified 1 year, 1 month ago by alainmelsens.
    Thread Starter alainmelsens

    (@alainmelsens)

    Hi,
    I guess I have discovered the reason for the problem myself.
    I was also using the PHP Opcache capabilities and indeed, I thought the SQLite settings were being held in a cache somewhere. And this is apparently correct.
    Because if I remove the PHP Opcache capabilities in the php.ini file and thus no longer use PHP Opcache, SQLite plugin does work correctly. Now the SQLite settings do get tracked correctly every time. and it also works well for the operation of that other FastDup plugin.
    I do also still use the typical PHP WinCache capabilities for Windows IIS and these do not give any problems for now.
    Either special PHP Opcache parameters need to be changed, but I don’t have enough knowledge about that yet.
    I understand very well, that I don’t need all those different Cache options. Maybe SQLite combined with APCu also works fast enough, and so PHP Opcache is now totally unnecessary?
    Can you explain a bit more about this please?

    • This reply was modified 1 year, 1 month ago by alainmelsens.
    Plugin Author OllieJones

    (@olliejones)

    Thanks for letting me know how you made this work correctly! What versiion of php do you run with IIS?

    I thought I understood the relationship between Opcache and APCu. I guess I don’t on Windows platforms. I’ll leave this topic open pending at least some fixes.

    Thread Starter alainmelsens

    (@alainmelsens)

    Hi,
    I am already using the latest PHP version 8.4.4 on Windows Server 2022 with IIS version 10.
    On the other hand, experienced no problems with other plugins except with FastDup which apparently does have problems finishing the backup when APCu is also enabled via your SQLite plugin.
    By now being able to turn it off via your SQLite plugin, the Fast Dup plugin does work correctly again. I have also already notified the developers of FastDup of this observation.
    Apparently, some PHP cache settings also work on the Backend or Back Office or administrator side of WordPress which, among other things, can cause such backup plugins or such plugin as yours SQLite to have problems due to internal conflicts of PHP caches. Apparently, it is not recommended to use too many combinations of PHP caches. I can understand that last one.

    Thread Starter alainmelsens

    (@alainmelsens)

    Hi,
    I am no expert myself on all these different PHP cache options. They can be set with sometimes a lot of parameters in the php.ini file, but the proper functioning and what consequences this can have is very unclear to me.
    Perhaps adjusting certain parameters in the php.ini file for APCu and Opcache could ensure that both cache components are allowed to be used together again? But I have no knowledge or experience with that. I will leave this to you then because only since your SQLite plugin can use APCu, the problems with APCu in combination with Opcache occur.
    For now, I have removed Opcache from my Windows IIS web server systems so that both your SQLite plugin and FastDup can work normally again. However, I do not notice any major speed loss.
    Feel free to let me know if you have any other suggestions for possibly using PHP Opcache again in the meantime.
    Because I now know that PHP APCu rather caches variables and PHP Opcache caches the PHP opcode or the way PHP works. Surely 2 totally different functionalities?

    • This reply was modified 1 year, 1 month ago by alainmelsens.
    • This reply was modified 1 year, 1 month ago by alainmelsens.
    Thread Starter alainmelsens

    (@alainmelsens)

    Hi,
    Meanwhile, this morning I was unable to log in to a website also running your SQLite plugin.
    Every time I was logged in, and I clicked on a menu within the admin or backend of WordPress, I was immediately logged out again. Finally, in the wp-config.php, I had to remove that first line with ‘define( “WP_SQLITE_OBJECT_CACHE_APCU”, true );’. And now it works fine. But so APCu is turned off.
    On the other hand, when I also removed the line with a Key Salt from the wp-config.php file, I got an error message with Crystal error and the website stopped working.
    I am afraid to note that your SQLite plugin is not working stably especially on Windows IIS web servers since that addition with APCu. I have now turned off APCu for now.

    Plugin Author OllieJones

    (@olliejones)

    For clarity for other users: this problem is specific to Windows / IIS.

    This SQLite Object Cache plugin works well without the APCu cache feature activated. So, you will still get a benefit from using it, even if you avoid APCu. Beware, though, by default it puts its .sqlite file in the .../wp-content/ folder. The .sqlite file cannot be placed on a share drive. Concurrent writes to the cache are unreliable in that situation. (Meaning: the cache mostly works, and is more likely not to work when your site is under a heavy load. That’s a terrible kind of reliability problem.)

    If your ...wp-content/ folder is on a share drive you must move your .sqlite file somewhere else. The location of the .sqlite file is set by WP_SQLITE_OBJECT_CACHE_DB_FILE in wp-config.php, and is not stored in any cache.

    There’s definitely a problem with the checkbox for opting in to APCu not being set correctly after opting in. https://github.com/OllieJones/sqlite-object-cache/issues/68 Thanks for that defect report. The workaround is to refresh the settings page after setting the checkbox. A fix is coming soon.

    I’ve done some testing with WIndows 11 / IIS 10 / php 8.1, and APCu seems to work OK, with or without WinCache being present.

    Opcache is always present in php these days unless you disable it. It’s the just-in-time script parser that makes php performance acceptable. If it were disabled, your whole site would run so much slower that the WordPress Persistent Object Cache would be the least of your worries. The site-owner-accessible php APIs for it look like they control cache refreshes and loading, but don’t offer user-visible caching features. Can you explain what you do, exactly, when you “remove Php opcache capabilities?”

    WP_CACHE_KEY_SALT is used by many WordPress components. Once it is set, it is wise not to change it. This plugin uses it as a prefix for cache keys in APCu, and for part of the name of its .sqlite file.

    Thanks again for your help sorting this out.

    Thread Starter alainmelsens

    (@alainmelsens)

    Hi,
    May I ask why you are talking about a shared drive? I work on a separate web server where the hard disk is not shared with other users. But several WordPress websites that also use the same PHP settings are running on the same Windows IIS web server. Or do you mean that the hard disk is indeed shared by several WordPress websites?
    Could you please clarify this again?
    Thanks in advance.

    Plugin Author OllieJones

    (@olliejones)

    You’re not using a file share (a file server) for your ...wp-content/ folder? That is good. My comments about .sqlite files on share drives don’t apply to your configuration. Pay them no attention.

    I’ve had other users with confusing failures who were on share drives.

    Thread Starter alainmelsens

    (@alainmelsens)

    Hi,
    Thank you very much in advance for all your clear explanations. I am already starting to understand everything better. Now I know better what certain parameters are for and especially how to use them correctly.
    It is now clear why my websites crashed when I removed that Key Salt from the wp-config file. Your SQLite plugin did not find the cache files as a result.
    Still, I know well by now that you are constantly improving and looking for your plugin to make our WordPress websites run faster. That APCu certainly seems very useful to me. Currently it is still off. However, it is turned back on in the php.ini file just as Opcache is also turned back on along with WinCache. For now, everything works correctly again. The other FastDup backup plugin also works as before.
    Still, I hope you might find a decent solution to make that APCu also work properly together with that other Opcache and WinCache.
    Thanks in advance to definitely inform me if you have any suggestions back that might be of interest to make that APCu more stable.
    If I can help, I will certainly try this. Unfortunately, I cannot guarantee that I will be able to do this immediately because I have many other tasks at work.
    Again, thanks for your great support. 😉

    Plugin Author OllieJones

    (@olliejones)

    Ahhh, thanks for your clarification. And your willingness to help. I’m a solo developer and depend on help like yours. I will hustle to get the bug fixed. https://github.com/OllieJones/sqlite-object-cache/issues/68

    And, it might be good to rethink the use of that key salt. Or, at any rate warn people about changing it or removing it in the Installation instructions.

    I really hope for a zero-config or almost-zero-config plugin. I hope that is possible.

    I stood up a Windows 11 VM with IIS 10 on it. I can mess around with Opcache and WinCache, and look for conflicts and trouble like that.

    Thread Starter alainmelsens

    (@alainmelsens)

    Hi,
    I am also constantly testing out different possibilities.
    Meanwhile, I did discover that, Opcache may well be behind why turning APCu on and off in your SQLite plugin does not work correctly.
    At least it does on Windows IIS platforms.
    Because I already have some experience with another plugin that can reset Opcache. This one is called ‘WP Opcache’ for short and it offers the option to reset or empty the current Opcache.
    With that, if I first reset the Opcache and then turn on or off APCu at your SQLite plugin, it does work correctly so far.
    And when APCu is off, the backup plugin ‘FastDup’ also works correctly.
    Then I empty the Opcache again and can turn APCu back on for normal but slightly faster website performance.
    I will keep testing this for now and will keep you updated.
    For now, this seems like a plausible solution. Of course, in that case, people should also use that ‘WP Opcache’ plugin.
    Perhaps in your plugin, when turning APCu on and off, you also test whether people are using Opcache and then also reset or clear it first? If so, I think this might be a better alternative?
    If necessary, provide me with a separate download weblink somewhere with a new test version of your SQLite plugin. Then I’ll test this one myself first.
    Feel free to let me know what you think?

    • This reply was modified 1 year, 1 month ago by alainmelsens.
    Plugin Author OllieJones

    (@olliejones)

    Please see the Github issue to get access to a test version of the plugin, and thanks!

    https://github.com/OllieJones/sqlite-object-cache/issues/70

    Thread Starter alainmelsens

    (@alainmelsens)

    Hi,
    Your web link to the test version does not work. I got the error: Oops! That page can’t be found.
    Please correct that web link that I can test this right away.
    Thanks in advance.

    • This reply was modified 1 year, 1 month ago by alainmelsens.
Viewing 15 replies - 1 through 15 (of 17 total)

The topic ‘APCu object cache setting does not work properly’ is closed to new replies.