Share » Learn » eZ Publish » The eZ publish Web Server Environment

The eZ publish Web Server Environment

Friday 04 August 2006 1:41:00 pm

  • Currently 3 out of 5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Because the eZ publish CMS is written using the PHP scripting language (PHP is a recursive acronym for "PHP: Hypertext Preprocessor"), a PHP server-side engine is required. PHP is a widely used Open Source general-purpose scripting language that is especially suited for Web development and is used mainly for producing dynamic web content and server-side applications.

Obtaining PHP

PHP is free software. You can download packages either the complete source code or the pre-compiled binaries from http://www.php.net/downloads.php.

Make sure you install PHP 4.4. We recommend that your use the latest version of the 4.4 branch. Please note that eZ publish will not work correctly with PHP 5.

Building and installing PHP

If your Linux distribution does not include PHP (or does not include the correct version of PHP) you can compile PHP from source. Before you start make sure that you have access to the root account.

The basic commands you must execute to compile and install PHP 4.x.x from source are:

shell> cd /usr/local/src
shell> gunzip < /PATH/TO/php-4.x.x.tar.gz | tar xvf -
shell> cd php-4.x.x
shell> ./configure --with-apxs=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/apache/conf --with-mysql --enable-memory-limit --enable-mbstring --with-ttf --with-gd --with-jpeg-dir --enable-gd-native-ttf --with-png-dir --with-freetype-dir --with-zlib --with-dom --enable-exif
shell> make
shell> su -
shell> make install

A more detailed description of the steps for compiling and installing PHP 4.x.x from source follows:

1. Choose the directory under which you want to unpack the distribution, and then change location into it. In the following example, we unpack the distribution under /usr/local/src.

shell> cd /usr/local/src

2. Obtain a PHP distribution from http://www.php.net/downloads.php.

3. Unpack the source file, which creates the installation directory. This example shows how to unpack the distribution using gunzip:

shell> gunzip < /PATH/TO/php-4.x.x.tar.gz | tar xvf -

The tar command creates a directory called "php-4.x.x" (where "4.x.x" is the PHP version number). If you are using GNU tar, no separate invocation of gunzip is necessary. Instead, you can use the following command to uncompress and extract the distribution:

4. Change location into the installation directory:

shell> cd php-4.x.x

5. Run the configuration script with following parameters:

./configure --with-apxs=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/apache/conf --with-mysql --enable-memory-limit --enable-mbstring --with-ttf --with-gd --with-jpeg-dir --enable-gd-native-ttf --with- png-dir --with-freetype-dir --with-zlib --with-dom --enable-exif

These parameters are interpreted as follows:

--with-apxs=/usr/local/apache/bin/apxs

Compiles PHP as a shared module for Apache. This means that you will get a libphp4.so file that you will load into Apache as a dynamic module.

--with-config-file-path=/usr/local/apache/conf

Tells PHP to look for the php.ini configuration file in /usr/local/apache/conf.

<span>--with-mysql</span>

Compiles PHP with support for MySQL. If you have compiled MySQL yourself or if MySQL is located outside the default PATH on your system, you should specify --with-mysql=/PATH/TO/MYSQL to make sure that PHP is compiled using the correct version of MySQL. You will be able to check this with the phpinfo(); command when PHP is running. We highly recommend that you specify the path to the MySQL installation due to the fact that the client library available in PHP 4.4 is not up-to-date.

--enable-memory-limit

This options enables the ability to change the memory_limit allowed for each PHP script in the php.ini file. By default, the memory limit is set to 8 MB. Instructions for increasing the memory limit are included in the "Configurating Apache and PHP" section. When PHP is compiled with this option, you can see how much memory is used on eZ publish page processing by viewing the debug output. This option also helps prevent buggy scripts from consuming all available memory on a server.

You can also disable the memory limit for a slight performance increase, since PHP then does not have to check if the memory limit has been exceeded.

--enable-mbstring

This enables the multibyte string functions in PHP that are used by eZ publish for multibyte character sets.

--with-ttf / --with-freetype-dir  --with-jpeg-dir --enable-gd-native-ttf --with-png-dir

These configuration options are used with --with-gd to enable GD functionality for Freetype 1.x (--with-ttf), Freetype 2 (--with-freetypedir), JPEG support (--with-jpeg-dir), TrueType support (--enable-gd-native-ttf) and PNG support (--with-png-dir).

--with-gd

This option enables the GD Image functions in PHP. You must enable this if you intend to use eZ publish to create and manipulate image files in a variety of different image formats (for example, if you would like to use the gallery in eZ publish to resize images). You will also need this function to use the text-to-images function.

--with-zlib

This option enables the zlib compression functions in PHP that are used by eZ publish to transparently read and write gzip (.gz) compressed files.

--with-dom

This option enables the domxml extension that allows eZ publish to operate on an XML document with the DOM API. This will speed up performance, especially for multilingual sites where large XML translation files are used.

--enable-exif

With the exif extension enabled, eZ publish is able to work with image metadata. It can read metadata of pictures taken from digital cameras by working with information stored in the headers of the JPEG and TIFF images.

To see additional configuration options, run:

shell> ./configure --help

The configure script will take several minutes to run, as it tests for the availability of packages and prerequisites on your system and builds the Makefiles which will later be used to compile PHP.

6. Now you can build the PHP application by running the command:

shell > make

7. Switch to the root user before executing the following commands:

shell> su -

If you don't have access to the root account, ask your system administrator for help.

8. Next, install the package by running:

shell> make install

If there were no errors, PHP should be installed on your system. However, PHP requires some configuration, described in the next section, to make it work with Apache and MySQL.

Apache module (mod_php)

PHP can work as an Apache module or in CGI mode. For maximum performance we recommend that you install PHP as an Apache module. The difference between between the two is the execution method. When PHP is installed as CGI, for each script execution the server must load and start a PHP CGI process, which slows down the start up phase of the script's execution. For maximum performance and compatibility it is highly recommend that PHP is installed as an Apache module instead of CGI for eZ publish CMS.

PHP Command Line Interface (CLI)

Since version 4.3.0, PHP supports a new SAPI type (Server Application Programming Interface) named CLI ("Command Line Interface"). CLI's main focus is on developing shell (or desktop) applications with PHP. Note that CLI and CGI are different SAPIs, although they do share many of the same behaviors.

The CLI SAPI was released for the first time with PHP 4.2.0, but was still experimental and had to be explicitly enabled with the --enable-cli option when running ./configure. Since PHP 4.3.0 the CLI SAPI is no longer experimental and the option --enable-cli is on by default.

The PHP Command Line Interface is requirement for eZ publish to run the eZ publish PHP scripts from command line and access to all eZ publish features and do maintenance. For more information about the PHP CLI SAPI, refer to the PHP manual: http://php.net/manual/en/features.commandline.php

36 542 Users on board!

Tutorial menu

Printable

Printer Friendly version of the full article on one page with plain styles

Author(s)