by Pep
Computing
Ubuntu 10: install PHP memcached with igbinary support
Nov 4th
Because I needed the igbinary support for memcached, I couldn’t get the “pecl install” working for the PECL memcached module because it wouldn’t accept my compile flag (–enable-memcached-igbinary). My workaround is posted below.
- Install memcached server
- Install PHP igbinary extension
- Install libmemcached library
- Install PHP memcached extension
# first install memcached server using apt-get
$ apt-get install memcached
# make any changes to the config file, if necessary
$ vi /etc/memcached.conf
$ service memcached restart
Before installing the memcached extension for PHP, we need to install the igbinary package. Igbinary provides binary serialization for PHP objects and data which significantly speeds up the process.
$ pecl install igbinary
Now we need to make sure PHP loads the extension. To do that, open the file “/etc/php5/conf.d/igbinary.ini” and add the following:
[/etc/php5/conf.d/igbinary.ini]
extension=igbinary.so
Next step is to download a dependency called “libmemcached”, which is a C/C++ client library for the memcached server. It can be downloaded from http://libmemcached.org. At the moment of writing, the latest version is 1.0.2, which will be used in the following example.
$ wget http://launchpad.net/libmemcached/1.0/1.0.2/+download/libmemcached-1.0.2.tar.gz
$ tar xzvf libmemcached-1.0.2.tar.gz
$ cd libmemcached-1.0.2/
$ ./configure
$ make
$ make install
It’s time to install the actual memcached PECL extension. This will provide the Memcache class for your PHP code.
$ pecl download memcached
$ tar xzvf memcached-1.0.2.tgz
$ cd memcached-1.0.2/
$ phpize
$ ./configure –enable-memcached-igbinary
$ make
$ make install
What we did to load the igbinary extension, we’ll do it again for the memcached extension. Open the file “/etc/php5/conf.d/memcached.ini” and add:
[/etc/php5/conf.d/memcached.ini]
extension=memcached.so
Save and quit. Last thing to do is to restart the apache webserver, and check if the modules are loaded.
$ service apache2 restart
Memcached should now be loaded and should show up in phpinfo();. Please note that this way of enabling extensions might not work for everyone, depending on how your apache server is set up.
PHP Server Monitor 2.0.1 released
Oct 28th
ffmpeg 2-pass benchmark: threads 3 vs 7
Jan 8th
Processor: 2x Intel Xeon E5502 1.87GHz
Memory: 8 GB
OS: Ubuntu 8.10
Codec: mp4/h264
Bitrate: 1000 kbit/s
The results below are an average of 20 ffmpeg 2-pass runs for both 3 threads and 7 threads. The first file is a small one, 4.5 MB, the second file is 1.0 GB. The average durations are shown in the format mm:ss.
File 1
Duration: 29.88 s
Size: 4.5 MB
Total time reduced by: 30.4%
| pass 1 | pass 2 | total | |
| 3 threads | 00:08.78 | 00:36.3 | 00:45.1 |
| 7 threads | 00:06.1 | 00:25.3 | 00:31.4 |
File 2
Duration: 1452.60 s (24 min, 12.6 sec)
Size: 1.0 GB
Total time reduced by: 37.6%
| pass 1 | pass 2 | total | |
| 3 threads | 04:10.5 | 32:31.9 | 36:42.4 |
| 7 threads | 02:38.8 | 20:14.7 | 22:53.5 |
configure: error: not found. Please provide a path to MagickWand-config or Wand-config program.
Jun 24th
Are you trying to install the PHP imagick extension but keep getting this error?
Besides the imagick extension there are 2 packages you need: imagemagick and libmagick9-dev.
apt-get install imagemagick libmagick9-dev
pecl install imagick
Don’t forget to add “extension=imagick.so” to your php.ini file and you should be ready to go.
Save MySQL
Jan 1st
Quote:
If Oracle buys MySQL as part of Sun, database customers will pay the bill.
In April 2009, Oracle announced that it had agreed to acquire Sun. Since Sun had acquired MySQL the previous year, this would mean that Oracle, the market leader for closed source databases, would get to own MySQL, the most popular open source database.
If Oracle acquired MySQL on that basis, it would have as much control over MySQL as money can possibly buy over an open source project. In fact, for most open source projects (such as Linux or Apache) there isn’t any comparable way for a competitor to buy even one tenth as much influence. But MySQL’s success has always depended on the company behind it that develops, sells and promotes it. That company (initially MySQL AB, then Sun) has always owned the important intellectual property rights (IPRs), most notably the trademark, copyright and (so far only for defensive purposes) patents. It has used the IPRs to produce income and has reinvested a large part of those revenues in development, getting not only bigger but also better with time.
If those IPRs fall into the hands of MySQL’s primary competitor, then MySQL immediately ceases to be an alternative to Oracle’s own high-priced products. So far, customers had the choice to use MySQL in new projects instead of Oracle’s products. Some large companies even migrated (switched) from Oracle to MySQL for existing software solutions. And every one could credibly threaten Oracle’s salespeople with using MySQL unless a major discount was granted. If Oracle owns MySQL, it will only laugh when customers try this. Getting rid of this problem is easily worth one billion dollars a year to Oracle, if not more.
PHP Server Monitor version 2.0 released
Oct 19th
Source: PHP Server Monitor project page
It’s been a while since the last release, but finally the new version has arrived: PHP Server Monitor 2.0 has been released.
PHP Server Monitor is a script that checks whether the servers on your list are up
and running on the selected ports.
It comes with a web based user interface where you can add and remove servers or websites from the MySQL database,
and you can manage users for each server with a mobile number and email address.
With version 2.0 comes the support for websites as well. On the “Add server” page, you can choose
whether it’s a “service” or a “website”:
* service
A connection will be made to the entered ip or domain, on the given port. This way you can check if certain services on your machine are still running. To check your IMAP service for example, enter port 143.
* website
The previous version only tried to establish a connection to the server on port 80. If you are running multiple websites on 1 machine, there was no proper way to check each website for possible errors. Also it was impossible to make sure your site was really up and running, all you knew was that the server was still online.
This function takes care of that.
You can enter a link to a website (for example http://sourceforge.net/index.php), it will use cURL to open the website and check the HTTP status code (see http://en.wikipedia.org/wiki/List_of_HTTP_status_codes for details).
If the HTTP status code is in the 4xx range, it means an error occured and the website is not accesible to the public.
In that case the script will return a “status offline”, and will start sending out notifications.
The previous version sent you a notification every time a server was down or unreachable. Version 2 allows you to choose for a different setting. You can choose to only receive notifications if the status changes, if the server goes offline for the first time only, or the way it used to be.
Each server has it’s own settings regarding notification.
You can choose for email notification or text message (SMS). As of version 2.0, there are 3 gateways
available:
* Mollie – http://www.mollie.nl
* Spryng – http://www.spryng.nl
* Inetworx – http://www.inetworx.ch
For these gateways you need an account with sufficient credits.
If logging is enabled in the configuration, it will log any connection errors, emails and text messages sent.
The latest log records will be displayed on your web interface.
The cron/status.cron.php can be added as a cronjob which will keep the server status up to date.
This version of the monitor features 2 languages: English and Dutch. Unfortunately it is not compatible with the old version, since it’s been rewritten from scratch.
I’d appreciate any feedback you might have regarding this script. Please leave it on the sourceforge
project page (tracker), or send me an email (ipdope[at]users.sourceforge.net).
PHP: Only variable references should be returned by reference
Apr 24th
Take the following code example:
<?php
class myClass {
public $var = 1;
public function &getVar() {
return($this->var);
}
}
$obj = new myClass;
$value = &$obj->getVar();
?>
This looks like valid code, right? PHP wants you to use the & in both places to indicate that you want to return by reference, and that’s what we have. But how come that this code still generates the notice?
Quote from php “return” manual (http://php.net/return):
Note: You should never use parentheses around your return variable when returning by reference, as this will not work. You can only return variables by reference, not the result of a statement. If you use return ($a); then you’re not returning a variable, but the result of the expression ($a) (which is, of course, the value of $a).
While it’s a very simple mistake, it did take me while to figure this out.
Google Earth 100% CPU [solution]
Mar 26th
So I had just finished installing Google Earth on my laptop and was about to explore the brand new street view here in Holland, when, as soon as I open Google Earth, my CPU shoots to 100%. The program did start up but the graphics took ages to load and there was no possibility to navigate at all. After 5 unresponsive minutes I killed the application and restarted it. Same thing, no way to get anything to work.
But, thanks to Google, here’s the deal.. When you go to Tools -> Options, on the right side of your screen you’ll see “Graphics mode” with 2 options and “OpenGL” as the default selected one. Switch to “DirectX”, restart Google Earth and you’re ready to rock!
Hope this works for you!

