Versions of PHP in Ubuntu

If you have to maintain an open source project written in PHP, like we do with Chamilo at BeezNest, you'll have to test your software on multiple versions of PHP to make sure of how well your code is supported on these versions. Of course, being open source, you can publish it on Github and then benefit from Travis-CI to get tests run automatically, but some stuff might be tricky to do, and maybe you'd like to test one specific thing, quickly, under a specific PHP version. Well, it turns out you can probably do that with Docker.

Configure HP LaserJet 100 colorMFP M175nw scanner on Ubuntu

If you have bought an HP LaserJet 100 printer and have it connected on the network, but somehow fail to scan from it, here's how:
  • sudo apt-get install hplip (chances are you already did that, but in the worst case this will do nothing)
  • sudo hp-setup (this launches a new window)
  • search network (if you enabled this in the printer web config page, you can select the "Bonjour" protocol)
  • let it find your printer and select "download and install driver"
  • accept to "add printer"

Benchmark: dirname(__FILE__) vs __DIR__ in PHP

dirname(__FILE__) and __DIR__ give exactly the same result in PHP, although one (__DIR__) is evaluated at compile-time, while the other (dirname(__FILE__)) has at least part of it (the function) evaluated at execution time. Ever wondered what the difference is, in terms of efficiency, between the two? I've written a *very* simple script to try it out:
<?php
$loops = 100000000;
echo 'Testing dirname(__FILE__)' . PHP_EOL;
$start = time();
$dir = '';
for ($i = 0; $i < $loops; $i++) {
 $dir = dirname(__FILE__);
}
echo 'dirname(__FILE__) took ' . (time()-$start) . 's' .

MySQL and MariaDB innodb_file_per_table

For those of you pushing your MySQL instances to higher levels, you'll have realized at some point that all InnoDB tables share their indexing space into a single file (ibdata1, usually). This has several very bad outcomes:
  • the ibdata1 file becomes huge after some time (we've seen it pass the 8GB bar)
  • starting the MySQL server takes longer
  • deleting an InnoDB table *doesn't* reduce the space used by ibdata1
  • you have to shutdown your server, remove ibdata1 completely, then restart the server in order to reinitialize the ibdata1 file to a 0-size file (but th

Using php5-memcached to store sessions on distributed servers

This article is an extension of the previous article about storing sessions in Memcached with PHP. Using Memcached for sessions storage is generally a matter of speed (storing them in memory is faster than on disk) and of scalability (using a Memcached server allows you to have several web servers serving the same PHP application in a seamless way). In the previous article, we mentioned (3 years ago) that the php5-memcached extension did not seem to manage the storage of sessions quite well, or at least t

Using Chamilo juju charm to setup a dev environment on Digital Ocean

If you're in a hurry/on speed, know this:
  • this procedure is slightly more difficult (so longer) than installing the charm on Amazon
  • you can skip directly to "Installing Juju"
  • if you already have juju installed, you can skip to the last 2 lines of the "Installing juju" section
  • if you already have juju-docean installed and configured, you can skip directly to "Provisioning VMs"
  • otherwise, just continue reading, it's worth a few minutes...
This tutorial regroups a lot of advanced notions, so if you want to know more about one of the follo

Howto: Configuring session expiry time in Chamilo

Note: this article was originally written for Chamilo 1.9 but it is also valid for all versions 1.10 and 1.11. We seldom receive a request from users of Chamilo LMS saying their sessions are cut in the middle of their activity. And sure, it might so happen that you are in the middle of the redaction of a very large answer to an open question, or diserting on how the course is going to help you in the forum. And we get that it's super-frustrating to click "submit" and then get an error page.

Creating new tasks in chamilo course-sessions

In the category of little scripts that can make your life easier when managing huge Chamilo portals, this is a little one that creates one tasks-folder called "ALP" for the "Assignments" (work) tool in each active course for a portal where you have thousands of sessions, with one course per session. The script works for version 1.9.8 of Chamilo, but might need some adaptations to run on an older version, in particular considering the addDir() function from the main/work/work.lib.php library which was created there recently. You should put the file into any "one-level" directory under the Cha