PHP is a server-side scripting language designed for web development but also used as a general-purpose programming language. [read more at]

  • apache_maven

    Packt publishing has offered me to make a review of two of their new books (Thanks to them). I should receive free samples for review beginning of next week. Since it is two of my favorite subjects (Maven and Joomla!® ), I think it may also interest you. A review will follow in some days.


    Build and Manage Applications with Maven, Continuum, and Archiva

    • Install Apache Maven and follow the sample application to build up your project as quickly as possible
    • Test your applications to ensure maximum stability using Maven's inbuilt tools
    • Use Maven's report and checking tools to ensure the health of your projects
    • Explore Apache Continuum which will help you to ensure the health of your source code
    • Improve your team builds with the powerful combination of Maven, Archiva and Continuum
    • Install and run the repository manager Apache Archiva



    Joomla!® 1.5 Development Cookbook 

    • Make your extensions extensible, add extensions points to allow third parties to customize your extension
    • Create international extensions by enabling multilingual capabilities
    • Build more than just HTML pages - create PDF documents, Atom Feeds, and more!
    • Improve the user experience by adding Ajax
    • Create Atom and RSS feeds to keep users up-to-date
    • Utilize the power of Subversion to maintain your source code
    • Execute database queries and handle returned data in order to access and modify your data
    • Dynamically extend your database tables using JParameter to make your extensions more flexible
    • Keep your gremlins at bay by handling errors the Joomla! way
    • Work with the file system, interrogate existing files and folders and store data in the file system
    • Take control of your workflows by using to manage your Joomla! projects
  • googleBuzz.small Buzz is a new way to share updates, photos, videos and more, and start conversations about the things you find interesting.

    • Share updates, photos, videos, and more.
    • Start conversations about the things you find interesting.
    • You're already following the people you
    • Email and chat with the most in Gmail.
    • Follow your friends and get recommended
    • Buzz from others — all within Gmail.

    I did rewrite nearly the whole code in behind, better administrator panel, 2 different outputs, all is customizable through CSS, Better caching of all costly operations like RSS, profile retrieval.


    If you are limited with space in your template, use the compact layout:

    While if you have at least 320 pixel wide left/right/module size, you can enjoy the buzzy box output

    The administrator panel has now a bit more settings:


    Download GoogleBuzz module 1.1.0 for Joomla!

    googleBuzz.logo Enjoy

  • phpstorm_header

    JetBrains PhpStorm is a commercial IDE for PHP built on JetBrains' IntelliJ IDEA platform.

    PhpStorm provides intelligent editor for PHP code, HTML and JavaScript with on-the-fly code analysis and automated refactoring for PHP and JavaScript code. Code completion supports PHP 5.3 including namespaces and closures.

  • phpstorm_header

    JetBrains PhpStorm is a commercial IDE for PHP built on JetBrains' IntelliJ IDEA platform.

    PhpStorm provides intelligent editor for PHP code, HTML and JavaScript with on-the-fly code analysis and automated refactoring for PHP and JavaScript code. Code completion supports PHP 5.3 including namespaces and closures.

  • Ubuntu 10.10 (Maverick) is offering as for today a relative old version PHP 5.3.3, if you want to have a better version, you’ll have to trust an unofficial APT repository. Here is How

    Thanks to the NGINX team, you can find nearly the latest version of PHP online at

    Create a new file php5-ppa.list

    vi /etc/apt/sources.list.d/php5-ppa.list

    and depending on the version of your ubuntu, you can replace the word maverick with the oldest oneiric, natty, or the latest lucid

    deb maverick main
    deb-src maverick main

    run an update, to get the latest PHP version

    # apt-get update
    # apt-get dist-upgrade

    Alternatively you can still compile PHP on your own..

  • Do You want to install Mambo?, have a copy of Your productive mambo homepage running locally? or simply develop easily PHP/MySQL code? Do You want to make Mambo a try without the hassle of installations and configurations?
    EasyPHPmight be the answer!
    EasyPHP  is a complete software package allowing to use all the power and the flexibility that offers the dynamic language PHP and the effecient use of databases under Windows. Package includes an Apache server, a MySQL database, a fully PHP execution, as well as easy development tools for your web site or your applications.

    Read more... to see my experience with it:

    Install easyPHP
    EasyPHP is a complete software package allowing to use all the power and the flexibility that offers the dynamic language PHP and the effecient use of databases under Windows. Package includes an Apache server, a MySQL database, a fully PHP execution, as well as easy development tools for your web site or your applications.

    The latest stable version (v1.7) is made of:
    • Apache 1.3.27
    • PHP 4.3.3
    • MySQL 4.0.15
    • PhpMyAdmin 2.5.3

    and can be downloaded at:

    It is a windows executale, all You have to do is install it.
    Start EasyPHP in the programs menu
    Verify that EasyPHP is running in the system tray

    Check configuration, Apache and MySQl must be started.

    If not be sure not to have another apache process running on port 80

    Check proper installation of EasyPHP. Should open a web browser and drive You to this page

    Copy data from Your productive system (www)

    Copy How  
    all remote file Using Your favorite FTP tool  
    all data in remote Database With your provider HTML tool (PhpMyAdmin)
    Export all tables and content in a SQL file on your Disk

    Install file data locally

    Copy Your webserver root to: EasyPHP1-7www
    example: if EasyPHP is installed in E:/, then copy into E:/

    Restore database data locally

    Start a browser and go to

    Restore the Data in your new database by importing the SQL file.


    • Bloc by bloc (see picture) or
    • By importing the SQL zip file
      (not working for me as the browser is doing timeout
      since my Databse is quite big)
    If the restore is successful, create a user, as found in the configuration file of Mambo. Create a User
    • Of the same name and password, or
    • Create a new user (better because of security concerns) ut then do not forget to adapt the configuration.phpaccordingly.

    in Mambo/configuration.php
    ocate the mySQL login and password mambo is using
    $mosConfig_offline = '0';
    $mosConfig_host = 'localhost';
    $mosConfig_user = 'XXXX';
    $mosConfig_password = 'XXXXX';
    Grant this user all rights by clicking edit.

    Change Mambo settings


    there is a lot of chance that Your local Mambo is not at the same location of Your productive Mambo, so Small changes in Mambo/configuration.phpare needed:

    Example in production Example localy
    $mosConfig_absolute_path = ''; $mosConfig_absolute_path = 'E:/';
    $mosConfig_cachepath = ''; $mosConfig_cachepath = 'E:/';

    Create a cache directory locally (I never do a backup of this directory, as it can be quite big in production)

    Normally You're done!


  • Impact of Zend Optimizer on PHP Performance

    The Zend Optimizer FAQ answers the question "Why use the Zend Optimizer?" with this statement: "The standard Zend run-time compiler used by PHP is indeed extremely fast, generating code that is usually 2 to 10 times faster. But an application that uses the Zend Optimizer typically executes another 40% to 100% faster."

    Read the results of the load test HERE.

  • &160; &160;phpunit-logo selenium-logo xampp.logo

    A small how to install PHPUnit via PEAR in an XAMPP running on a windows box. A prerequisite for a continuous build strategy.

    PHPUnit is a member of the xUnit family of testing frameworks and provides both a framework that makes the writing of tests easy as well as the functionality to easily run the tests and analyze their results.

    Installing XAMPP

    • Download XAMPP from
    • Unpack the zip, don't run any installer, just use the \xampp\xampp-control.exe to control the component (so the whole XAMPP directory can be moved to another drive without having absolute paths in all configurations files)

    Installing PEAR

    • Execute&160; \xampp\php\go-pear.bat and follow the onscreen instructions. The installation will modify the include_path in your php.ini file.
    • Execute \xampp\php\PEAR_ENV.reg to add PEAR to the windows registry

    Installing PHPUnit

    • Open a command prompt
    • Execute&160; pear channel-discover
    • Execute&160; pear install phpunit/PHPUnit
    • Now you should find PHPUnit installed in \xampp\php\PEAR\PHPUnit\

    Installing Selenium

    • Execute&160; pear install Testing_Selenium

    Some useful pear commands to keep your PHP up to date

    • \xampp\php\pear list-upgrades
    • \xampp\php\pear upgrade-all

    All pear Commands

    build&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Build an Extension From C Source
    bundle&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Unpacks a Pecl Package
    channel-add&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Add a Channel
    channel-alias&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Specify an alias to a channel name
    channel-delete&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Remove a Channel From the List
    channel-discover&160;&160;&160;&160;&160;&160;&160;&160; Initialize a Channel from its server
    channel-info&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Retrieve Information on a Channel
    channel-update&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Update an Existing Channel
    clear-cache&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Clear Web Services Cache
    config-create&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Create a Default configuration file
    config-get&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Show One Setting
    config-help&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Show Information About Setting
    config-set&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Change Setting
    config-show&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Show All Settings
    convert&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Convert a package.xml 1.0 to package.xml 2.0 format
    cvsdiff&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Run a "cvs diff" for all files in a package
    cvstag&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Set CVS Release Tag
    download&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Download Package
    download-all&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Downloads each available package from the default channel
    info&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Display information about a package
    install&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Install Package
    list&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; List Installed Packages In The Default Channel
    list-all&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; List All Packages
    list-categories&160;&160;&160;&160;&160;&160;&160;&160;&160; List All Categories
    list-category&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; List All Packages of a Category
    list-channels&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; List Available Channels
    list-files&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; List Files In Installed Package
    list-packages&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; List All Packages of a Channel
    list-upgrades&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; List Available Upgrades
    login&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Connects and authenticates to remote server
    logout&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Logs out from the remote server
    makerpm&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Builds an RPM spec file from a PEAR package
    package&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Build Package
    package-dependencies&160;&160;&160;&160; Show package dependencies
    package-validate&160;&160;&160;&160;&160;&160;&160;&160; Validate Package Consistency
    pickle&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Build PECL Package
    remote-info&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Information About Remote Packages
    remote-list&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; List Remote Packages
    run-scripts&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Run Post-Install Scripts bundled with a package
    run-tests&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Run Regression Tests
    search&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Search remote package database
    shell-test&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Shell Script Test
    sign&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Sign a package distribution file
    uninstall&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Un-install Package
    update-channels&160;&160;&160;&160;&160;&160;&160;&160;&160; Update the Channel List
    upgrade&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Upgrade Package
    upgrade-all&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160;&160; Upgrade All Packages
    Usage: pear [options] command [command-options] <parameters>
    Type "pear help options" to list all options.
    Type "pear help shortcuts" to list all command shortcuts.
    Type "pear help <command>" to get the help for the specified command.

    Pear References

    PEAR: Getting the manager
    PEAR: Checking if PEAR works

  • As always updating to the latest version of all your developement components is never without any issues, here is what  you need to take into consideration when upgrading Joomla 3.8.7 and WinNMP 18.03

    Install WinNMp 18.03 from in any directory, default is C:\WinNMP\

    Unpack Joomla 3.8.7 to C:\WinNMP\WWW\dev for example

    When starting WinNMP, you can click reload, to see the site appearing


     Now edit Nginx virtual server


     And cut and paste the following config (you can get it from Joomla-Nginx-configuration">


    You can now install Joomla like you are used to, by opening a browser and pointing to http://dev.test

    After the installation you'll notice that the administrator area is broken, some CSS/Javascript can not be located (Http 404). To solve this, open with your favorite text editor joomla! configuration.php and set the live site property (was in Joomla 1.5, then removed then it appear again)


     Now the administrator area should work again... but you can not install any Joomla! extensions, because open_basedir = "c:/winnmp" and do not contains the temporary directory, you can safely deactivate it for development, but NOT on ANY production server.

    ;open_basedir = "c:/winnmp"

     Last but not least, php_uname is used by Joomla, activate it in php.ini to remove some warnings





  • In this series of post I will outline some common techniques to help Joomla extensions development.

    As you know Joomla is shipped with Mootools library which assign $ also to Ajax. Here is 2 tips that will allow you to use jQuery scripts without any modifications (most of the time you will find tips to assign jQuery to something else than $ and rewrite your scripts)

    First it is recommended to include always mootools first to avoid jQuery conflict issues

    $document = JFactory::getDocument();
    $document->addScript(JURI::root() . "media/com_cedtag/js/jquery.1.7.2.min.js");

    then to run jQuery in noConflict mode. Note that here I do not assign jQuery to any alias.


    Till here, this is what you will find on all Joomla forums, posts over the internet. The last tips is what make the difference!

    Instead of using a different alias for the jQuery object (when using noConflict), you can write your jQuery code by wrapping it all in a closure. This can be done in the document.ready function

    $script = "jQuery(function($) { $();

    });"; $document->addScriptDeclaration($script);

    This way you are not force to rewrite your scripts to use another alias (replacing $ with jquery alias for example in all your scripts). This make inclusion of jQuery really easy!

    Happy Coding!

  • joomla_cms

    Since months, now I (understand also YOU) receive some blank page when browsing my Internet homepage.

    This strange behavior seems to occur only when having PHP running as FastCGI

    FastCGI is a protocol for interfacing interactive programs with a web server. FastCGI is a variation on the earlier Common Gateway Interface (CGI); FastCGI's main aim is to reduce the overhead associated with interfacing the web server and CGI programs, allowing a server to handle more web page requests at once. [WikiPedia]

    The Apache logs are quite explicit:

    [error] [client x.x.x.x] FastCGI: comm with server "/srv/www/cgi-bin/php5" aborted: error parsing headers: duplicate header 'Status'

    The error is located in the file /libraries/joomla/environment/response.php, at the function JResponse::sendHeaders()

    The way header has to be send is different when using PHP FastCgi, strange that Joomla! 1.5.9 still do not have this in main stream code...

    Old code

     function sendHeadersOld()
      if (!headers_sent())
       foreach ($GLOBALS['_JRESPONSE']->headers as $header)
        if ('status' == strtolower($header['name']))
         // 'status' headers indicate an HTTP status, and need to be handled
         // slightly differently
         header(ucfirst(strtolower($header['name'])) . ': ' . $header['value'], null, 
    (int) $header['value']); } else { header($header['name'] . ': ' . $header['value']); } } } }

    This is how it should look like, code is backward compatible, if PHP run as an apache module.

     function sendHeaders()
      if (!headers_sent())
       foreach ($GLOBALS['_JRESPONSE']->headers as $header)
        if ('status' == strtolower($header['name']))
         // 'status' headers indicate an HTTP status, and need to be handled 
    // slightly differently
    $attribute = ucfirst(strtolower($header['name'])) . ': ' . $header['value']; if (substr(php_sapi_name(), 0, 8) == 'cgi-fcgi') { $attribute = str_replace("Status:", "HTTP/1.1", $attribute); } header($attribute, null, (int) $header['value']); } else { header($header['name'] . ': ' . $header['value']); } } } }
  • Came across this excellent collection of resources ( to learn object-oriented programming and related concepts for PHP developers. A lot of tutorials on OOP Fundamentals, OOP Advanced, Object Oriented Design, Design Patterns, Refactoring, Architecture, and more.
  • The Resin team has  implemented a PHP 5 engine in JAVA! Quercus is Caucho Technology's fast, open-source, 100% Java implementation of the PHP language.

    "Quercus is Caucho Technology's fast, open-source, 100% Java implementation of the PHP language. Quercus is a feature of Caucho Technology's Resin Application Server and is built into Resin - there is no additional download/install. Developers using Resin can launch PHP projects without having to install the standard PHP interpreter ( as Quercus takes on the role of the PHP engine."

    Joomla! is supported right out the box


    "Quercus and Quercus' PHP libraries are written entirely in Java, thereby taking the advantages of Java applications and infusing them into PHP. PHP applications running on Quercus are simply faster, easier to develop, more capable, more secure, and more scalable than any other PHP solution.
    Performance - simply faster, Development - fast, safe, and easy,  Capability - powerful Java technologies at the developer's fingertips, Security - no more pesky C memory bugs,  Scalability - PHP for the masses, literally"

    In fact the PHP code is translated into servlets and then compiled into java bytecode on the first run. So it should be quite fast and best of th best, I can use my java profiling tools and library :-)

  • If you consider using PHP on a new server, use  nothing else than PHP 5.2.3, it may be a pain to rewrite or patch foreign code, but PHP 5.2 is more secure and 100% faster than PHP4, moreover PHP4 is soon dead!

    PHP 4 end of life announcement
    "Today it is exactly three years ago since PHP 5 has been released. In those three years it has seen many improvements over PHP 4. PHP 5 is fast, stable & production-ready and as PHP 6 is on the way, PHP 4 will be discontinued.
    The PHP development team hereby announces that support for PHP 4 will continue until the end of this year only. After 2007-12-31 there will be no more releases of PHP 4.4. We will continue to make critical security fixes available on a case-by-case basis until 2008-08-08. Please use the rest of this year to make your application suitable to run on PHP 5. For documentation on migration for PHP 4 to PHP 5, we would like to point you to ourmigration guide. There is additional information available in thePHP 5.0 to PHP 5.1 andPHP 5.1 to PHP 5.2 migration guides as well. from

    If you are not able to use the latest version, consider applying PHP hardening patches from and compiling PHP  for yourself (these patches are no more needed in PHP 5.2 since they are part of the main source tree). A lot of  people already do that,  even if it is not easy.

    PHP applications should not execute OS code... Disable certain PHP functions (system,exec,shell_exec, phpinfo)
    Malicious commands can be executed though PHP shell functions. If some programs still require these functions, consider:
    • Looking for another application working without these functions.
    • Patching the code.
    • Asking authors to remove them, or find a workaround.
    A lot of people do not configure PHP correctly...

    In fact not so much people are correctly configuring their PHP runtime, as shown in this study of 11 000 hosts based on phpinfo() . How can hacker find such kind of  vital informations? quite easily thanks to any search engine.
    For example, in Google (the engine I know the best) by typing allinurl: phpinfo.php I get 39200 hosts that are revealing these vital settings

    Conclusions from PHP configuration statistics
    Configuration values hold surprises, or not. After reading those values, we may even wonder if some functionalities did require a directive or not...
    As usually, default values from the distribution are the most commonly used values : it shows how much trust PHP programmers have in the PHP group. Or, it may also show that too few people read the php.ini file, and understand it.
    1. Allways use the latest patch level version.
    2. Open and setup ALL  php.ini on disk (find / -name php.ini) this is especially true if you run more than one php version (php4/php5 as module of fast cgi)
    3. It is recommended to run PHP as fastCGI
    4. Recommended settings for a secure PHP are:
      register_globals = 0
      safe_mode = 1
      // a well written PHP appliation should not rely on these functions to operate
      disable_functions = show_source, system, shell_exec, passthru, exec, phpinfo, popen, proc_open
      allow_url_fopen = 0
      magic_quotes_gpc = 1
      open_basedir = /www/httprootdir
    more to come here soon
  • This interesting code snippet is from cedTag and let you retrieve WikiPedia description using OpenSearch API. It use the Client Url Library cURL. Released under GPL v3

     * @param $searchTerm
     * @param string $wikipediaServer
     * @return array|string  [text, description, url]
    public function getDefinitionFrom
    ($searchTerm, $wikipediaServer = '') { $url = $wikipediaServer.
    '/w/api.php?action=opensearch&search=' .
    urlencode($searchTerm) . '&format=xml&limit=1'; $ch = curl_init($url); curl_setopt($ch, CURLOPT_HTTPGET, true); curl_setopt($ch, CURLOPT_POST, false); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_NOBODY, false); curl_setopt($ch, CURLOPT_VERBOSE, false); curl_setopt($ch, CURLOPT_REFERER, ""); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_MAXREDIRS, 4); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERAGENT,
    "Mozilla/5.0"); $page = curl_exec($ch); $xml = simplexml_load_string($page); if ((string)$xml->Section->Item->Description) { return array((string)$xml->Section->Item->Text, (string)$xml->Section->Item->Description, (string)$xml->Section->Item->Url); } return ""; }
  • phpUnderControl metrics screenshot
    More screen shots here
    phpUnderControl is an add-on application for the continuous integration
    tool CruiseControl, which integrates some of the best PHP development tools.
    This project aims to make your first steps with CruiseControl and PHP as easy
    as possible. Therefore phpUnderControl comes with a command line tool that
    performs all modifications to an existing CruiseControl installation.

    My objective is to be able to set up this server and provide you all an access to the build result for my component.

    Integrated tools
    • Testing and software metrics

      PHPUnit is the most popular xUnit implementation for PHP that provides a framework for automated
      software tests. Except the pure test automation PHPUnit contains a rich set of features like
      Code Coverage, Project Mess Detection and Software Metrics. To visualize the generated XML reports
      phpUnderControl comes with a set of XSL stylesheets that prepare the output for CruiseControl.

    • Documentation

      phpUnderControl uses the most common documentation tool for PHP projects, PhpDocumentor, to generate
      an up to date documentation of the software on every build cycle. Therefore the developers will always get
      the latest API documentation of their project. Additionally phpUnderControl extracts the documentation
      violations found by the PhpDocumentor and visualizes these as an additional quality report in the user
      interface and the project time line of documentation violations.

    • Coding Standards

      With the package PHP_CodeSniffer the PEAR project gave PHP developers a very useful tool to detect coding
      standard violations in a project. Since version 1.0.0RC3 it has native support for the Checkstyle XML format
      that can be visualized by CruiseControl. PHP_CodeSniffer comes with a variety of pre defined coding standards
      like PEAR and ZEND but due to its modular structure you can easily implement a custom rule set or extend one
      of the pre defined sets. This development tool assures that the whole project code will remain clean and

  • An impressive sum of links and good articles on PHP, worth reading!

    This list of recommended reading material on PHP is compiled from a variety of online sources by Web application developers in IBM's Global Production Services organization. These resources have been selected with the intention of introducing IT specialists and architects to PHP, providing specific information about development and maintenance, and helping to integrate the technology with IBM products.

    PHP is an interpreted programming language run in an environment provided by an open source core engine and extensions whose development is driven by many companies and individuals. As such, this list describes resources that apply to writing PHP programs and to customizing the interpreter's environment. It links to material published by IBM and content provided by others. From IBM developerWorks

  • Selenium is a test tool for web applications. Selenium tests run directly in a browser, just like real users do. It runs in Internet Explorer, Mozilla and Firefox on Windows, Linux, and Macintosh, Safari on the Mac.&160; They have plans to target Safari on the iPhone in some months. The tool is free and available under Apache 2.0.

    • Install the firefox plugin, note the latest version work only in Firefox 2.0 not in 3.0Beta!
    • Install also XPather another Firefox extension, very helpful to get the elements&160; XAPTH in pages.
    • Of course restart Firefox
    • Open either the sidebar (go to menu View, Sidebar, Selenium IDE) or the floating windows
      (go to menu Tools - Selenium IDE)
    • Go to the page where you wan to test something
    • Put the right Base URL (A) and press button (B) when ready
    • You can now act like any user, enter data, change values, click on links
    • When You wan to add a check, you can at any time right click on a HTML element
      (a text, a cell, a button...) to see what selenium is proposing you.
    • Not all possibility are this is where knowing the element XPATH is helping...
      for more complex check, you can right click on any element and get the XPATH
      doYourFirstSeleniumTest.3 doYourFirstSeleniumTest.4
      now just cut and paste and feed the command (I choose verifytextPresent)
    • Don't forget to stop the engine when you are finished or the script may be huge.
    • Into C, You can now cut and paste one or many lines, insert new commands (add more assert)
    • And replay seleniumSecurityImages2 till the&160; bar is green



    • Do not abuse XPATH expression as it somehow hard code the previous position of the element in the page.
    • Try to make each test run on its own, do not expect that the test before is successful (so login. test functionality 1, logout)
    • Keep unit test small,
    • Keep all test in a repository (CVS or SVN) or many backup.

    Read also:

  • Joomla! Doc has a great documentation online that explains how to set up your development environment

    This article provides detailed instructions for setting up your workstation for Joomla! development. Note that there are many possible configurations for doing Joomla! development. Any environment that supports Apache, MySql, PHP, and Subversion should work for writing Joomla! code and extensions.

    This document provides step-by-step instructions for setting up and working with the Eclipse IDE. The example used and screen shots are for Windows XP, but the basic steps are the same for Linux.

    The part 1 mainly explains how to install technical components

    The part 2 is even better as it explains how to create patches for Joomla! along with some eclipse tips and tricks.

  • Since I am facing performance problem due to the load of visitors and a badly configured server, I decide today to document my findings in this new series of articles.

    FastCGI is an extention to CGI that increases speed. Instead of creating a new process every time a page is reloaded, FastCGI will use the same process, queuing up requests. This increases startup speed, at the expense of forcing users to wait for the previous requests to finish. FastCGI also allows programs to get the web server to do certain operations, like reading in a file, before the request is handed over. [WikiPedia]

    FastCGI provides a way to keep PHP frequently-run script files loaded on Your server so that script are already preloaded and initialized the next time they are used. This can make some scripts run up to five times more quickly (in most cases it's as fast as mod_php, without the drawbacks). Moreover You can run different version of PHP (PHP4 and PHP5) in the same server...

    Server: Strato (
    Operating system: SuSE / openSuSE
    Requirements: root access and basic Unix knowledge


    1 Use yast2 to install mod_fastcgi on the system, this will create files (*.so) in   /usr/lib/apache2-worker/ and  /usr/lib/apache2-prefork/
    2 Edit the file  
    # vi /etc/sysconfig/apache2

    and add fastcgi, suexec
    remove php4/php5 if any

    APACHE_MODULES="fastcgi cache mem_cache deflate headers access actions alias auth auth_dbm autoindex cgi dir env expires include log_config mime negotiation setenvif ssl   userdir php4 php5 perl     rewrite suexec"
    3 create a new file in /etc/apache2/conf.d/mod_fastcgi.conf

    vi /etc/apache2/conf.d/mod_

    and add these lines, at the end of file, adapt all path according to your system. Keep in mind, I have a SuSE system

    <IfModule mod_fastcgi.c>
        ScriptAlias /fcgi-bin/ /srv/www/fcgi-bin/
        FastCgiIpcDir /var/lib/apache2/fastcgi
        # FastCGI applications can be static, dynamic, or external.
        # Dynamic FastCGI applications can be put in this directory.
        # Use the FastCgiConfig directive in your httpd.conf.local
        # to change the defaults for them.
        # mod_fastcgi.htmlFastCgiConfig

        <Directory "/srv/www/fcgi-bin">
            AllowOverride None
            Options +ExecCGI -Includes
            SetHandler fastcgi-script
            Order allow,deny
            Allow from all
        AddHandler fastcgi-script fcg fcgi fpl

        # Static or external FastCGI applications are started when apache
        # is started. They are configured with the
        # FastCgiServer and FastCgiExternalServer directives:
        # mod_fastcgi.htmlFastCgiServer

        # mod_fastcgi.htmlFastCgiExternalServer

        # which can be put into httpd.conf.local.
        # Examples:
        FastCgiServer /srv/www/fcgi-bin/echo -processes 5
        FastCgiServer /srv/www/htdocs/some/path/echo.fcgi
        # see
        # for more  information...

        Alias /php5-fcgi/ /srv/www/cgi-bin/
        FastCgiServer /srv/www/cgi-bin/php5  -processes 5
        AddType application/x-httpd-fastphp5 .php5
        Action application/x-httpd-fastphp5 /php5-fcgi/php5

        Alias /php4-fcgi/ /srv/www/cgi-bin/
        FastCgiServer /srv/www/cgi-bin/php  -processes 5
        AddType application/x-httpd-fastphp4 .php
        Action application/x-httpd-fastphp4 /php5-fcgi/php


    4 start
    # apache2-reconfigure-mpm
    this recreate the file  /etc/apache2/sysconfig.d/loadmodule.conf
    and restart apache automatically.


  • I put some effort the last few days in this new framework.


    • I did document some part of it at
    • TeamCity is installed/configured/documented (windows only)
    • XAMPP is installed/configured/documented (windows only)
    • I also at the same time configured a Puppy Linux VMWare image that will permit to anybody to have a running environment in no time.
    • I am able to unpack all Joomla! versions that are committed in any repository (CVS, SVN, Clearcase)
    • They can be unpacked anywhere on file system (config in setEnv.xml), ideally they are unpacked in the root htdocs of XAMPP
    • Code is committed at Joomla forge in SVN


    Selenium test suite do not accept a baseurl (or only a part of it) so I have a full path like /Joomla1.5.7/installation/index.php in a selenium test case instead of /installation/index.php in test case and baseurl= http://localhost/Joomla1.5.7)


    3rd Party

    • I use antelope for some advance ANT operations: substring, indexof, loop
    • I use selenium java server on port 4444 (default)


    All cluster operations are in cluster.xml these basic functions are

    • cluster.init
      • cluster.remove&160;&160;&160;&160;&160;&160;&160; remove all instances of Joomla! in checkout directory
      • joomla.unpack.all&160;&160;&160; unpack all Joomla! versions that are checked in another SVN root
      • joomla.install.all&160;&160;&160;&160;&160; run the same selenium test case joomla.install.html on all Joomla! instance
      • joomla.remove.all.installation&160;&160; remove all Joomla! installation directories
      • joomla.check.all&160;&160;&160;&160; check all Joomla! installations for correctness
    • cluster.start
    • cluster.remove
    • cluster.stop


    All Joomla specific operations are in joomla.library.xml

    • Unpack a Joomla! version
    • Remove the installation directory form a version
    • Apply a selenium test suite install.joomla.html that can use the regular Joomla! installer
    • Is also able to do all of the above on all Joomla! versions found (regular expression) in checkout directory


    • All selenium operations are in selenium.xml
    • All test suite and test cases are in /selenium/joomla/


    All PHPUnit operation are in phpunit.xml


    Settings are in setEnv.xml, in future I will lazy load a file if it exist as environment variable


    If you know ANT, the code is quite readable...

  • The Alternative PHP Cache (APC) is a free and open opcode cache for PHP. It was conceived of to provide a free, open, and robust framework for caching and optimizing PHP intermediate code. from

    Unpack your distribution file. You will have downloaded a file named something like apc_x.y.tar.gz. Unzip this file with a command like
    # wget
    # gunzip apc_x.y.tar.gz

    Next you have to untar it with
    #  tar xvf apc_x.y.tar

    This will create an apc_x.y directory. cd into this new directory:
    # cd apc_x.y

    phpize is a script that should have been installed with PHP, and is normally located in /usr/local/php/binassuming you installed PHP in /usr/local/php. (If you do not have the phpize script, you must reinstall PHP and be sure not to disable PEAR.).

    Locate phpize:
    # find / -name phpize

    mine is in
    yours may be in /usr/local/php/bin/phpize

    Run the phpize command:
    #  /usr/local/php/bin/phpize

    Its output should resemble this:
            Configuring for:
              PHP Api Version:   20020918
              Zend Module Api No:   20020429
              Zend Extension Api No:   20021010

    phpize should create a configure script in the current directory. If you get errors instead, you might be missing some required development tools, such as autoconf or libtool. You can try downloading the latest versions of those tools and running phpize again.

    Run the configure script.

    phpize creates a configure script. The only option you need to specify is the location of your php-config script.

    find location of php-config
    # find / -name php-config
    # ./configure --enable-apc --enable-apc-mmap --with-apxs --with-php-config=/etc/alternatives/php-config

    php-config should be located in the same directory as phpize.
    If you prefer to use mmap instead of the default IPC shared memory support,  add --enable-apc-mmap to your configure line.

        If you prefer to use sysv IPC semaphores over the safer fcntl() locks, add --enable-sem to your configure line.  If you don't have a problem
        with your server segaulting, or any other unnatural accumulation of semaphores on your system, the semaphore based locking is slightly faster.

    Compile and install the files.
    Simply type:
    # make install
    Installing shared extensions:     /usr/lib/php5/extensions/

    Suggested Configuration (in your php.ini file)

    Although the default APC settings are fine for many installations, serious
    users should consider tuning the following parameters:

        OPTION                  DESCRIPTION
        ------------------      --------------------------------------------------
        apc.enabled             This can be set to 0 to disable APC. This is
                                primarily useful when APC is statically compiled
                                into PHP, since there is no other way to disable
                                it (when compiled as a DSO, the zend_extension
                                line can just be commented-out).
                                (Default: 1)

        apc.shm_segments        The number of shared memory segments to allocate
                                for the compiler cache. If APC is running out of
                                shared memory but you have already set
                                apc.shm_size as high as your system allows, you
                                can try raising this value.  Setting this to a
                                value other than 1 has no effect in mmap mode
                                since mmap'ed shm segments don't have size limits.
                                (Default: 1)

        apc.shm_size            The size of each shared memory segment in MB.
                                By default, some systems (including most BSD
                                variants) have very low limits on the size of a
                                shared memory segment.
                                (Default: 30)

        apc.optimization        This option has been deprecated.
                                (Default: 0)

        apc.num_files_hint      A "hint" about the number of distinct source files
                                that will be included or requested on your web
                                server. Set to zero or omit if you're not sure;
                                this setting is mainly useful for sites that have
                                many thousands of source files.
                                (Default: 1000)

        apc.user_entries_hint   Just like num_files_hint, a "hint" about the number
                                of distinct user cache variables to store.
                                Set to zero or omit if you're not sure;
                                (Default: 4096)

        apc.ttl                 The number of seconds a cache entry is allowed to
                                idle in a slot in case this cache entry slot is
                                needed by another entry.  Leaving this at zero
                                means that your cache could potentially fill up
                                with stale entries while newer entries won't be
                                (Default: 0)

        apc.user_ttl            The number of seconds a user cache entry is allowed
                                to idle in a slot in case this cache entry slot is
                                needed by another entry.  Leaving this at zero
                                means that your cache could potentially fill up
                                with stale entries while newer entries won't be
                                (Default: 0)

        apc.gc_ttl              The number of seconds that a cache entry may
                                remain on the garbage-collection list. This value
                                provides a failsafe in the event that a server
                                process dies while executing a cached source file;
                                if that source file is modified, the memory
                                allocated for the old version will not be
                                reclaimed until this TTL reached. Set to zero to
                                disable this feature.
                                (Default: 3600)

     apc.cache_by_default    On by default, but can be set to off and used in
                                conjunction with positive apc.filters so that files
                                are only cached if matched by a positive filter.
                                (Default: On)

        apc.filters             A comma-separated list of POSIX extended regular
                                expressions. If any pattern matches the source
                                filename, the file will not be cached. Note that
                                the filename used for matching is the one passed
                                to include/require, not the absolute path.  If the
                                first character of the expression is a + then the
                                expression will be additive in the sense that any
                                files matched by the expression will be cached, and
                                if the first character is a - then anything matched
                                will not be cached.  The - case is the default, so
                                it can be left off.
                                (Default: "")

        apc.mmap_file_mask      If compiled with MMAP support by using --enable-mmap
                                this is the mktemp-style file_mask to pass to the
                                mmap module for determing whether your mmap'ed memory
                                region is going to be file-backed or shared memory
                                backed.  For straight file-backed mmap, set it to
                                something like /tmp/apc.XXXXXX (exactly 6 X's).
                                To use POSIX-style shm_open/mmap put a ".shm"
                                somewhere in your mask.  eg.  "/apc.shm.XXXXXX"
                                You can also set it to "/dev/zero" to use your
                                kernel's /dev/zero interface to anonymous mmap'ed
                                memory.  Leaving it undefined will force an
                                anonymous mmap.
                                (Default: "")

        apc.slam_defense        ** DEPRECATED - Use apc.write_lock instead **
                                On very busy servers whenever you start the server or
                                modify files you can create a race of many processes
                                all trying to cache the same file at the same time.
                                This option sets the percentage of processes that will
                                skip trying to cache an uncached file.  Or think of it
                                as the probability of a single process to skip caching.
                                For example, setting this to 75 would mean that there is
                                a 75% chance that the process will not cache an uncached
                                file.  So the higher the setting the greater the defense
                                against cache slams.  Setting this to 0 disables this
                                (Default: 0)

                                When you modify a file on a live web server you really
                                should do so in an atomic manner.  That is, write to a
                                temporary file and rename (mv) the file into its permanent
                                position when it is ready.  Many text editors, cp, tar and
                                other such programs don't do this.  This means that there
                                is a chance that a file is accessed (and cached) while it
                                is still being written to.  This file_update_protection
                                setting puts a delay on caching brand new files.  The
                                default is 2 seconds which means that if the modification
                                timestamp (mtime) on a file shows that it is less than 2
                                seconds old when it is accessed, it will not be cached.
                                The unfortunate person who accessed this half-written file
                                will still see weirdness, but at least it won't persist.
                                If you are certain you always atomically update your files
                                by using something like rsync which does this correctly, you
                                can turn this protection off by setting it to 0.  If you
                                have a system that is flooded with io causing some update
                                procedure to take longer than 2 seconds, you may want to
                                increase this a bit.
                                (Default: 2)

        apc.enable_cli          Mostly for testing and debugging.  Setting this enables APC
                                for the CLI version of PHP.  Normally you wouldn't want to
                                create, populate and tear down the APC cache on every CLI
                                request, but for various test scenarios it is handy to be
                                able to enable APC for the CLI version of APC easily.
                                (Default: 0)

        apc.max_file_size       Prevents large files from being cached.
                                (Default: 1M)

        apc.stat                Whether to stat the main script file and the fullpath
                                includes.  If you turn this off you will need to restart

     apc.write_lock          On busy servers when you first start up the server, or when
                                many files are modified, you can end up with all your processes
                                trying to compile and cache the same files.  With write_lock
                                enabled, only one process at a time will try to compile an
                                uncached script while the other processes will run uncached
                                instead of sitting around waiting on a lock.
                                (Default: 1)

        apc.report_autofilter   Logs any scripts that were automatically excluded from being
                                cached due to early/late binding issues.
                                (Default: 0)

        apc.rfc1867             RFC1867 File Upload Progress hook handler is only available
                                if you compiled APC against PHP 5.2.0 or later.  When enabled
                                any file uploads which includes a field called
                                APC_UPLOAD_PROGRESS before the file field in an upload form
                                will cause APC to automatically create an upload_<key>
                                user cache entry where <key> is the value of the
                                APC_UPLOAD_PROGRESS form entry.

                                Note that the file upload tracking is not threadsafe at this
                                point, so new uploads that happen while a previous one is
                                still going will disable the tracking for the previous.
                                (Default: 0)

        apc.localcache          This enables a lock-free local process shadow-cache which
                                reduces lock contention when the cache is being written to.
                                (Default: 0)

        apc.localcache.size     The size of the local process shadow-cache, should be set to
                                a sufficently large value, approximately half of num_files_hint.
                                (Default: 512)

                                Optimize include_once and require_once calls and avoid the
                                expensive system calls used.
                                (Default: 0)

  • Thanks to Nathan Rennie-Waldock. you can have the latest PHP5 5.3.10 running in Ubuntu Oneiric, Natty, Maverick and Lucid.

    PHP 5.3.10 fixes critical remote code execution vulnerability

    The vulnerability was introduced by the fix for a hash collision denial-of-service flaw

    Proof-of-concept code that exploits this vulnerability has already been published online

    Nathan Rennie-Waldock Personal Package Archives (PPA) is located at

    Just run as root the following to use PHP 5.3.10

    sudo add-apt-repository ppa:nathan-renniewaldock/ppa
    sudo apt-get update
    sudo apt-get upgrade

    Canonical should be a little bit ashamed to not deliver these security patches for the server edition! relying on individuals to provide the latest version of secure software is not promoting Linux in enterprise.

  • Thanks to Ondřej Surý,&160; maintainer for some Debian packages, you can have the latest PHP5 maintained by Debian PKG PHP Team in Ubuntu Oneiric, Natty, Maverick and Lucid.

    Currently it is the previous version 5.3.9, but that’s already a lot better than 5.3.6 (Official in Ubuntu 11.10 Oneiric). I did contact Ondřej to ask him for updating the Personal Package Archive to 5.3.10.

    Personal Package Archives (PPA) allow you to upload Ubuntu source packages to be built and published as an apt repository by Launchpad.

    Ondřej Surý’s Personal Package Archives (PPA) is located at

    Just run as root the following to use PHP 5.3.9

    sudo add-apt-repository ppa:ondrej/php5 
    sudo apt-get update
    sudo apt-get upgrade

    I did create an account at just in case I would like to build some packages for Ubuntu.

  • Since I did not find any clear how to on the internet how to run test cases for 3rd party extensions that use Joomla CMS, here is my version of it.


    Having PHPUnit properly install, if you use XAMPP you may want to read this post.


    How to use PHPUnit in Joomla

    At the root of your Joomla installation directory, make a checkout of

    You’ll need at least the following file

    • ${joomla_root}\tests\unit\bootstrap.php
    • ${joomla_root}\tests\unit\config.php
    • ${joomla_root}\tests\unit\JoomlaDatabaseTestCase.php
    • ${joomla_root}\tests\unit\JoomlaTestCase.php
    • ${joomla_root}\tests\unit\phpunit.xml
    • ${joomla_root}\tests\unit\readme.txt

    config.php is a custom or a copy of your configuration.php

    For your convenience, I provide a zip file (, unpack in your Joomla root and you’re done.

    Note when using PHPUnit 3.6 , Joomla should not need to include/require anything PHPUnit related since (at least) PHPUnit 3.6. This create errors otherwise.

    In PHPStorm

    Set Up PHPUnit

    Go to Settings, using CTRL+ALT+S, under PHPUnit, select the option “Use Bootstrap file” and use as value ${joomla_root}\tests\unit\bootstrap.php

    Set Up PHPUnit Skeleton Generator

    Go to Settings, using CTRL+ALT+S, under “Skeleton Generator”

    • Enter for “Path to phpunit-skelgen” the value is  ${xampp_root}\php, for example C:\xampp\php
    • Enter for “use bootstrap file” the value ${joomla_root}\tests\unit\phpunit.xml

    Your first Joomla test case

    Create a test case from any of your Joomla classes, by hitting CTRL+SHIFT+T, this will let you select the method you want to test and generate a runnable albeit incomplete test classes.

    It is only the beginning of testing your Joomla extensions, there is a lot now to learn

    • Mocking objects in Joomla, Stubbing of Joomla classes
    • Invoking protected method using TestReflection::invoke
    • How to create integration tests using the database
    • How to test the user interface using PHPSelenium
    • and more…

    These links may interest you