Ressources documentaires pour Mandriva Linux et les Logiciels Libres

eZ Components under Mandriva

Since some months, I’m using eZ Components for the intranet of my society. I’m specifically using the Graph component which allow to produce some very beautiful graphs, especially when using the SVG or the Cairo output driver.
At the beginning, I installed eZ Components by using the big tar.bz2 package which contains all the component plus the documentation and the regression tests. This was very big. The best way to install eZ Components and ease its maintenance if your distribution is not providing the packages is to use PEAR. So here is the way to install eZ Components by using PEAR on Mandriva. However this HOWTO may apply to others distributions.

  1. You need to have a working PHP+Apache stack : For this you may use the task-lamp-php metapackage which will install a working Apache + PHP + PEAR setup : [bash light= »1″]urpmi task-lamp-php[/bash]

    As you may noticed, this will install MySQL support. If you’d rather have PostgreSQL support, you just need to install the php-pgsql package.

  2. Install the needed requirements for the eZ Components : Each eZ Components have some requirements on some PHP extensions. You can consult the requirements on the eZ Components requirements page. For all components, you need pcre, reflection and spl support in PHP. Theses supports are available by default in the Mandriva PHP package. The Graph component require for example dom and xml support, and eventually gd support if you want to generate JPG/PNG images. To install the needed requirements, you just need to install the corresponding PHP packages which consist on the PHP extension name prefixed by php- : [bash light= »1″]urpmi php-xml php-dom[/bash]

    . If you want to generate graphics by using the Flash output, you need to install also php-ming. For high quality PNG graphics, you will have to install PHP cairo wrapper. Unfortunately as this package is not bundled in Mandriva, you will have to compile it and install it manually. For this please follow my previous about installation of PHP cairo wrapper under Mandriva

  3. Restart Apache to load PHP extensions : In order to activate the newPHP extension, you need to restart Apache : [bash light= »1″]service httpd restart[/bash]
  4. Add eZ Components PEAR channel : [bash light= »1″]pear channel-discover[/bash]
  5. Install the wanted eZ Components : Now you can easily the components you want to use by using PEAR. For example to install the Graph component you just need to do : [bash light= »1″]pear install ezc/Graph[/bash]

    . If at the contrary you want to install all the eZ Components, then you will use the following commande instead :

    [bash light= »1″]pear install -a ezc/eZComponents[/bash]

  6. Updates handling : To updates the components, you just need to replace install by upgrade in the PEAR command. For example to update the Graph component to a newer version, you will use : [bash light= »1″]pear upgrade ezc/Graph[/bash]

    . People who install the full eZ Components may want to use instead : pear upgrade ezc/eZComponents[/bash]

  7. Add eZ Components support in your PHP script : Adding eZ Components support in your PHP script is easy. On Mandriva, PEAR packages are in the default include/require PATH, so you just need to add the following lines at the top of your PHP scripts to be able to load automatically the different components on demand :
      spl_autoload_register( array( 'ezcBase', 'autoload' ) );

As you can see, adding eZ Components support in your PHP application is easy, and many components may be useful. In some further HOWTO, we will see how to use the graph components by using a wrapper function. However don’t hesitate to consult the well-written eZ Components documentation.

Similar posts

Aucun commentaire jusqu'à présent.

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *


My Tweets