Userland APCU cache and i-MSCP customer' sites

  • Hello,



    I would use the apcu cache, so I turned, but it does not work for imscp users.



    There he has a few things else to do or enable?



    Thank you in advance.

  • @raln


    Helo ;


    Depending on the i-MSCP httpd server implementation in use on your server, you must add the needed APC directives, either:

    • in the pool configuration files located at /etc/php5/fpm/pool.d if you're using PHP5-FPM
    • in the php.ini files located under /var/www/fcgi if you're using FCGID
    • in the php.ini file located at /etc/php5/apache2/php.ini if you're using ITK


    If you want those changes persistent for all your customers, you could instead edit the related templates which can be found under the /etc/imscp directory (just search a bit), and once done, you should rerun the imscp-setup script to regenerate all configuration files.

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • Hello,
    Thank you for your reply, I use itk, so I had already changed the php.ini, but nothing to do. The cache does not work with the hosted sites.
    Thank you in advance.

  • I also tried to apc.cache_by_default = 1, but nothing to do.
    Thank you in advance.

  • Hello;


    Tell us what you have done exactly to enable APCU.

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • Hello,



    I change the value in php.ini:



    [apc]
    apc.enabled = 1
    extension = apcu.so



    Then I set the values for APCU
    It is in operation, but puts nothing in cache:





    Thank you for your help

  • Give me some minutes. I'll give a try with ITK.


    BTW: Where did you downloaded that APCU interface?

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • Okay, thank you.



    I took it in /usr/share/doc/php5-apcu/apc.php

  • Ok, give me some minutes to test.

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • It works for me.


    Howto (tested under Ubuntu Trusty)


    • I've installed the php5-apcu package:

      Shell-Script
      1. # aptitude install php5-apcu
    • I've run the following command to be sure that APCU is enabled:

      PHP
      1. # php5enmod apcu

      Note: It is useless to add the extension = apcu.so in the php.ini file since there is already an /etc/php5/mods-available/apcu.ini file.

    • I've edited the /etc/php5/apache2/php.ini file and changed the folllowing configuration snippet:

      PHP
      1. [apc]apc.enabled = 0

      by

      PHP
      1. [apc]apc.enabled = 1
    • I've restarted Apache2

      Shell-Script
      1. # service apache2 restart
    • I've copied the apc.php file in my htdocs folder:

      Shell-Script
      1. root@trusty:/var/www/virtual/test.tld/htdocs# cp /usr/share/doc/php5-apcu/apc.php .root@trusty:/var/www/virtual/test.tld/htdocs# chown vu2003.vu2003 apc.php
    • I've created an index.php file with the following content:

      PHP
      1. <?php// Add num variable to data storeapc_add('num', 1); // Print initial valueecho "Initial value: ", apc_fetch('num'), [b]"<br />"[/b]; // Update old value with a new valueapc_cas('num', 1, 10); // Print just updated valueecho "Updated value: ", apc_fetch('num'), "<br />"; // Decrease a stored numberecho "Decrease 1: ", apc_dec('num'), "<br />";echo "Decrease 3: ", apc_dec('num', 3), "<br />"; // Increase a stored numberecho "Increase 2: ", apc_inc('num', 2), "<br />";echo "Increase 1: ", apc_inc('num'), "<br />";
    • I've loaded the index.php file. Result was:

      Code
      1. Initial value: 1
      2. Updated value: 10
      3. Decrease 1: 9
      4. Decrease 3: 6
      5. Increase 2: 8
      6. Increase 1: 9
    • I've loaded the apc.php file. Result was:
      apcu.png

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206