Sebastian Nohn

Weblog

PHP on Cruise - Assuring compatibility with new PHP versions

Assuring compatibility with new PHP versions is not always easy: Features are added and changed in minor versions, bugs you didn't even know they exist and having been open for years "suddenly" get fixed. Sometimes BC breaks are inevitable. On the other hand there are no bug fix-only or security fix-only releases, so you are more or less forced to regularly update your PHP.

Assuring compatibility however is easy with a little help of CruiseControl as long as you have automated tests for your software: PHP on Cruise

Basically, PHP on Cruise fetches the latest version of the CVS (stable) tree, compiles it with your standard configure options and runs your tests. If these tests pass, you should be fine with the next version. If these tests fail, either PHP has been broken, or your application uses deprecated stuff or uses bugs as features. If the latter is the case, you have enough time to fix your application (you should by the way think about setting up continuous builds for your own project). If not, you should report the issue at bugs.php.net to make PHP better.

Making PHP better is another issue to publish this little howto: Although PHP QA has evolved in the last two years by heavily improving the test coverage with the help of gcov there are still several things to improve: Broaden the tests and broaden the test base. PHP on Cruise helps with that by allowing everyone to run his own tests on his own platform in his own configuration without investing too much time.

Posted Apr 15, 2007
Tagged as: CruiseControl, PHP, Software Development, Software Quality

Selenium extension for PHPUnit has arrived.

The Selenium Extension for PHPUnit has arrived.

Posted Oct 04, 2006
Tagged as: PHP, PHPUnit, Selenium, Software Quality

Don't upgrade to PHP 5.1.3

http://bugs.php.net/bug.php?id=37276

Posted May 04, 2006
Tagged as: PHP, Software Quality

Using Net_DNSBL and Nagios to check if your SMTP server is listed in a RBL

RBLs are a great way to get rid of a lot of SPAM (if you choose the right ones). On the other hand you (and users of your mail server) get in big trouble if your SMTP server gets listed on a common RBL.

Checking this manually is a job that sucks a lot, checking this automatically is an easy job with Nagios, PHP, Net_DNSBL and Console_Getopt.

I assume, you have Nagios up and running and installed according to FHS.

Install the required PEAR packages via

# pear install -a Net_DNSBL Console_Getopt

The code for a non-idiot proof, but working RBL checker is simple:

#!/opt/php/bin/php
<?php

define
('SERVICE_STATUS''Service Status:');

require_once 
'Console/Getopt.php';
require_once 
'Net/DNSBL.php';

$dnsbl = new Net_DNSBL();

$shortoptions 'H:V::r:';
$longoptions = array('hostname=''version==''rbls=');

$con = new Console_Getopt;
$args $con->readPHPArgv();
array_shift($args);
$options $con->getopt2($args$shortoptions$longoptions);

foreach(
$options[0] as $option) {
  if (
$option[0] == 'H' || $option[0] == '--hostname') {
    
$hostname $option[1];
  }
  if (
$option[0] == 'r' || $option[0] == '--rbls') {
    
$rbls_temp $option[1];
  }
}

if (!isset(
$hostname) || !isset($rbls_temp)) {
  echo 
SERVICE_STATUS.' Unknown'."\n";
  exit(
3);
} else {
  
$rbls explode(','$rbls_temp);
  
$dnsbl->setBlacklists($rbls);
  if (
$dnsbl->isListed($hostname)) {
    echo 
SERVICE_STATUS.' Critical - Listed in '.$dnsbl->getListingBl($hostname)."\n";
    exit(
2);
  } else {
    echo 
SERVICE_STATUS.' OK - Not Listed in supplied DNSBLs'."\n";
    exit(
0);
  }
}
?>

Put this into your Nagios plugin directory (/opt/nagios/libexec) and add this to /etc/opt/nagios/checkcommands.cfg:

define command{
        command_name    check_dnsbl
        command_line    $USER1$/check_dnsbl -H $HOSTADDRESS$ -r $ARG1$
        }

As well as this to /etc/opt/nagios/services.cfg:

define service{
        use                             generic-service
        host_name                       your.mail.server
        service_description             DNSBL
        is_volatile                     0
        check_period                    24x7
        max_check_attempts              3
        normal_check_interval           3
        retry_check_interval            1
        contact_groups                  nohn
        notification_interval           120
        notification_period             24x7
        notification_options            w,u,c,r
        check_command                   check_dnsbl!bl.spamcop.net,some.other.comma.separated.rbls
        }

Finally you have to restart Nagios:

# /etc/init.d/nagios restart

Posted Apr 18, 2006
Tagged as: Console_Getopt, Nagios, Net_DNSBL, PEAR, PHP, RBL, SMTP, SPAM

GD graphics library becomes a PHP project

Some years ago, the GD library was forked by the PHP project for easier building PHP with graphics support. Building GD library and PHP with GD support was always a hassle and this fork has made life much easier for PHP people.

Unfortunately, the author of the original project, Thomas Boutell, ran out of time and so had not the time to backport improvements and fixes done by the PHP development team nor do his own improvements and fixes to the library.

The consequence: Thomas has proposed to make the GD library an official PHP project and have the development of that library moved over to php.net. It seems that Pierre is going to be the new GD lead.

Congratulations to that - in my eyes perfect - decision of Thomas to propose the move, Rasmus to "accepting" GD as a PHP project and Pierre to volunteer being project lead of this well known and quite common library.

Posted Apr 02, 2006
Tagged as: GD graphics library, PHP

<<< Page 1 of 2 >>>