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.


  • 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.


  • Hello,

    I change the value in php.ini:

    apc.enabled = 1
    extension =

    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?


  • Okay, thank you.

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

  • Ok, give me some minutes to test.


  • It works for me.

    Howto (tested under Ubuntu Trusty)

    • I've installed the php5-apcu package:

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

      1. # php5enmod apcu

      Note: It is useless to add the extension = 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:

      1. [apc]apc.enabled = 0


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

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

      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:

      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:

      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: