Set your xcache.ini configuration (/etc/php5/conf.d/xcache.ini) to match your
system. For example, you *could* have something like this (intentionally
hiding comments here):
<pre>
xcache.shm_scheme = "mmap"
xcache.size = 32M
xcache.count = 2
xcache.slots = 8K
xcache.ttl = 0
xcache.gc_interval = 0
xcache.var_size = 16M
xcache.var_count = 16
xcache.var_slots = 8K
xcache.var_ttl = 60
xcache.var_maxttl = 300
xcache.var_gc_interval = 300
xcache.test = Off
</pre>
xCache will feel useless until you actually start to put some variables in
cache. If you're showing the "Who is online" counter, that's one of the
best item there is to implement xCache.<br/>
For example, you could implement it this way (in main/inc/lib/banner.lib.php):<br/>
<pre>
$xc = function_exists('xcache_isset');
$number = 0;
if ((api_get_setting('showonline', 'world') == 'true' AND !$user_id) OR (api_get_setting('showonline', 'users') == 'true' AND $user_id) OR (api_get_setting('showonline', 'course') == 'true' AND $user_id AND $course_id)) {
if ($xc && xcache_isset('campus_chamilo_org_whoisonline_count_simple')) {
if ((api_get_setting('showonline', 'world') == 'true' AND !$user_id) OR (api_get_setting('showonline', 'users') == 'true' AND $user_id) OR (api_get_setting('showonline', 'course') == 'true' AND $user_id AND $course_id)) {
An optional additional caching mechanism you may use is the realpath_cache_size
and realpath_cache_ttl php.ini parameters.
See <ahref="http://php.net/manual/en/ini.core.php">the PHP documentation</a>
for more details.
<br/>
<br/>
<h3>APC</h3>
If you prefer using <ahref="http://php.net/manual/en/book.apc.php">APC</a>,
you can use the same kind of trick as above, just changing the code a little:
<pre>
$xc = function_exists('apc_exists');
$number = 0;
if ((api_get_setting('showonline', 'world') == 'true' AND !$user_id) OR (api_get_setting('showonline', 'users') == 'true' AND $user_id) OR (api_get_setting('showonline', 'course') == 'true' AND $user_id AND $course_id)) {
if ($xc) {
$apc = apc_cache_info(null,true);
$apc_end = $apc['start_time']+$apc['ttl'];
if (apc_exists('my_campus_whoisonline_count_simple') AND (time() < $apc_end) AND apc_fetch('my_campus_whoisonline_count_simple') > 0 ) {
if (apc_exists('my_campus_whoisonline_count_simple_'.$_course['id']) AND (time() < $apc_end) AND apc_fetch('my_campus_whoisonline_count_simple_'.$_course['id']) > 0) {
In PHP 5.5 and above, APC is rendered practically obsolete by the presence of ZendOPCache by default.
However, APC does not cover the "user cache", like the caching of specific variables in memory.
Considering this, you can <ahref="http://php.net/manual/en/book.apcu.php">APCu</a> to add the same level of variable caching as described above, just changing the code a little:
On a local computer, this lead to an increase of RAM consumption and a decrease of 20% of CPU time (for just one user). This has been included in 1.11.x, so this section is only there for historical purposes.
<pre>
function return_notification_menu()
{
$_course = api_get_course_info();
$course_id = 0;
if (!empty($_course)) {
$course_id = $_course['code'];
}
$user_id = api_get_user_id();
$html = '';
$cacheEnabled = function_exists('apcu_exists');
if ((api_get_setting('showonline', 'world') == 'true' && !$user_id) ||
if (apcu_exists('my_campus_whoisonline_count_simple_'.$_course['id']) AND (time() < $apc_end) AND apcu_fetch('my_campus_whoisonline_count_simple_'.$_course['id']) > 0) {
if ((api_get_setting('showonline', 'world') == 'true' AND !$user_id) OR (api_get_setting('showonline', 'users') == 'true' AND $user_id) OR (api_get_setting('showonline', 'course') == 'true' AND $user_id AND $course_id)) {
Create 10 directories inside the app/upload/users directory (from 0 to 9) and update your admin settings. This has to be done at install & configuration time, otherwise you might loose user data (or have to write a script for data distribution).
The default in Chamilo is now to spread user accounts in 10 different directories inside app/upload/users/ to avoid
overloading that specific directory. Nothing to be done here. Please move on.
Although this will not make your server faster, compressing the pages you are sending to the users will definitely make them feel like your website's responses are a lot faster, and thus increase their well-being when using Chamilo.<br/><br/>
Although this will not make your server faster, compressing the pages you are sending to the users will definitely
make them feel like your website's responses are a lot faster, and thus increase their well-being when using Chamilo.<br/><br/>
Zlib output compression has to be set at two levels: PHP configuration for PHP pages and Apache for images and CSS.<br/><br/>
To update the PHP configuration (either in php.ini or in your VirtualHost), use the <ahref="http://php.net/manual/en/zlib.configuration.php">zlib.output_compression</a>. If you set this inside your Apache's VirtualHost, you should use the following syntax.
To update the PHP configuration (either in php.ini or in your VirtualHost), use the
<ahref="http://php.net/manual/en/zlib.configuration.php">zlib.output_compression</a>. If you set this inside your
Apache's VirtualHost, you should use the following syntax.
<pre>
php_value zlib.output_compression 1
</pre>
@ -705,7 +488,7 @@ This should have an immediate effect on the load average on your server.