Installing eZ publish 4
From InstallationWiki
| Official Page |
| Project Documentation |
| Download |
|
Contents |
[edit] Installation
Before we start using the CMS/F, we have to check if our system is ready for it. As our first task, we will have to see if the hosting requirements are fulfilled. Then we will configure the PHP interpreter according to eZ Publish's needs.
[edit] Hosting requirements
One of the most important things to understand is that hosting plays a very important role in managing eZ Publish. The minimum requirements for installing eZ Publish, in terms of both software and hardware, are discussed in the subsequent sections.
[edit] Software required
- Apache server 1.3 or 2 if 2.x is installed, then the prefork package is used.
- MySql Server 4.1 or higher
- PHP 5.1 but PHP 5.2 is recommended, compiled as a module for Apache and not installed as a CGI (eZ Publish does not work well with PHP installed as a CGI)
- Support for the GD graphics libraries, if ImageMagick is not available
- Support for Apache mod_rewrite, if you want to use the friendly URL
- FTP access, but SFTP/SSH access is recommended
- The eZ Components library
[edit] Hardware required
The installation requires about 50 MB on your hard disk, but as always, the more space you reserve for the system the better. For a good system experience, we suggest some minimum values: at least 1GHz CPU and 512 MB of dedicated RAM.
[edit] PHP configuration
As with any other software application developed in PHP, eZ Publish also needs some configuration to better work with the interpreter. The most important is the one related to memory usage and timezone settings. Moreover, the same settings should be applied to both the command-line site and to the Apache (or IIS) module.
PHP memory limit issue
eZ Publish needs at least 64 MB (but 128 is preferred) in order to complete the Setup Wizard. If you are using PHP 5.2.0 or an earlier version, you'll have to increase the default memory_limit setting, which is located in the php.ini configuration file (don't forget to restart Apache after editing php.ini). Normal operation requires about 16 MB. However, it is highly recommended that you keep the 64 MB setting as eZ Publish consumes a lot more memory as soon as you re-index the search, execute upgrade scripts, and so on.
If you are using PHP 5.2.1 or later, there is no need to change the default memory_limit setting (it is set to 128 MB by default).
PHP timezone
You need to set the date.timezone value in the php.ini configuration file. If this setting is not specified, you will most likely receive error messages like "It is not safe to rely on the system's timezone settings" when running eZ Publish on PHP 5. The following example shows what the corresponding line in php.ini looks like:
date.timezone = <timezone>
Refer to the PHP documentation for the list of supported timezones. As before, don't forget to restart Apache after editing php.ini.
[edit] Shared versus dedicated hosting
One of the main questions to consider before using eZ Publish is whether to use shared or dedicated hosting. There is no simple answer because the choice depends on the type of site that you develop. You have to take note that the variables that affect the performance of the CMS are:
- Number of page views per unit of time
- Number of concurrent visits
- Complexity of the template
- Freshness of content
- Number of nodes
If the site that you want to develop is a showcase site for a company, with few pages and few visitors, then the minimum requirements we saw in the previous paragraph will be sufficient.
If you want to develop a great site for a media agency, such as the project we'll develop in the next tutorials, a site with high freshness of content, with a respectable number of visitors per day (over 5,000 unique visitors), where we will add advanced features and the ability of users to add content, then the minimum requirements will increase to:
- Dedicated Hosting
- 1 GB RAM
- Linux OS
- At least 1GB of free disk space
- Cronjobs management
- SSH access
- The eZ components library
For medium-sized projects, you can also use a Virtual Private Server (VPS), but if the site receives a lot of visits and the CMS makes extensive use of a caching system, then the performance could be diminished because of slow I/O. As a rule of thumb, when possible, try to avoid using virtual disks if you plan to have a popular site.
[edit] eZ components
eZ Publish is an object-oriented application where each class definition is stored in a separate PHP source file. When eZ Publish is installed, all of the class definitions of the eZ Publish kernel will have their paths listed in the autoload/ezp_kernel.php
file. In addition, the autoload/ezp_extension.php file will contain an array of paths for class definitions that are a part of the extensions that come with eZ Publish. These arrays will most likely need to be updated at some stage (for example, when you install new extensions or configure existing ones by using the Setup | Extensions part of the administration interface). Doing this requires eZ components version 2007.1.1 (or higher). In particular, you need to install the File and Base components (ezcBase and ezcFile). Otherwise, eZ Publish will not be able to update autoload arrays.
eZ components is an enterprise-ready, general purpose PHP components library, used for PHP application development. eZ components can be downloaded from http://ezcomponents.org/download. In the future, eZ components will be bundled with eZ Publish. Refer to [http://ezcomponents.org/docs/install for information about how to install eZ components.
Starting from version 2008.1, the eZ components library requires PHP version 5.2.1 or higher.
There are three ways to make eZ components available for your
PHP environment:
- Use the PEAR Installer for convenient installation via the command line
- Download eZ components, packaged in an archive
- Get the latest source from SVN
Installing eZ components by way of the PEAR Installer is highly recommended, as it is the most convenient and safest way. You can find all required documentation on how to do this at http://www.ezcomponents.org/docs/install.
| If you are in a shared hosting environment, and it is impossible for you to install eZ components as PEAR, there is a trick to installing it. First of all, you will have to download the latest version of the components from http://www.ezcomponents.org/download. Then you have to extract the archive to the eZ Publish root, and rename the folder ezc. Now, in the same directory, you have to create a file named config.php, and enter the following code in it:
<?php set_include_path( "./ezc:" . ini_get( "include_path" ) ); ?> |
[edit] Setting up
After setting up the system, we need to perform a series of other tasks, before installing eZ Publish, such as creating a database or configuring the Apache environment.
| All examples are written to be performed from a shell, under the Linux operating system. If you do not have a shell, you can still perform all of these tasks through the tools provided by your host. |
[edit] Unpacking the installation
First of all, download the latest version of eZ Publish from http://www.ez.no/ download (at the time of writing this tutorial, the latest version is 4.0.1). Unzip the file that you downloaded, to your web root, and rename the folder with the name of the project.
For example:
# cd /var/www wget http://ez.no/content/download/242355/1643191/version/1/file/ ezpublish-4.0.1-gpl.tar.gz # tar -xvfz ezpublish-4.0.1-gpl.tar.gz # mv ezpublish-4.0.1 packtmediaproject # cd packtmediaproject
|
From now on, every time we refer to the eZ Publish root, we are talking about this directory (the directory to which we unzipped the CMS). |
[edit] Initializing the database
Once you have unpacked the source code of eZ Publish, you must create a new database. It is important that the charset (character set) of the new database is UTF-8 as this has been a mandatory requirement for a correct installation since version 4.0.
| eZ Publish can use both MySQL and PostgreSQL. In this tutorial, all of the examples refer to the former, but you are free to use the latter. |
To create a new database, open a shell and use the following code, which shows how to set the character set:
# mysql -u root Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.0.67 MySQL Community Server (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> CREATE DATABASE packtmediaproject CHARACTER SET = 'utf8';
Now create a separate user called packuser who owns all rights to manage the database, and who can access the database only from localhost. You'll use this user in the eZ Publish configuration files.
mysql> GRANT ALL ON packtmediaproject.* TO 'packtuser'@'localhost' IDENTIFIED BY 'packtpwd'; Query OK, 1 row affected (0.00 sec) mysql> FLUSH PRIVILEGES; Query OK, 1 row affected (0.00 sec)
[edit] Apache virtual host settings
A virtual host setup is needed by eZ Publish only when configured to use the host access method, which is the suggested method.
When using virtual hosts, it is possible to have several sites running on the same server. The sites are usually differentiated by the name under which they are accessed. Apache will look for a specified set of domains and use different configuration settings based on the domain that is accessed.
Virtual hosts are usually defined at the end of the httpd.conf file, which is the main configuration file for Apache, and is placed on Debian-based distribution in /etc/ apache2/conf. Adding a virtual host for eZ Publish can be done by copying the following lines and replacing the text encapsulated by the square brackets with real values.
Please refer to the following code for a real-life example of using virtual hosts.
NameVirtualHost [IP_ADDRESS] <VirtualHost [IP_ADDRESS]:[PORT]> <Directory [PATH_TO_EZPUBLISH]> Options FollowSymLinks AllowOverride None </Directory> <IfModule mod_php5.c> php_admin_flag safe_mode Off php_admin_value register_globals 0 php_value magic_quotes_gpc 0 php_value magic_quotes_runtime 0 php_value allow_call_time_pass_reference 0 </IfModule> DirectoryIndex index.php <IfModule mod_rewrite.c> RewriteEngine On RewriteRule content/treemenu/? /index_treemenu.php [L] Rewriterule ^/var/storage/.* - [L] Rewriterule ^/var/[^/]+/storage/.* - [L] RewriteRule ^/var/cache/texttoimage/.* - [L] RewriteRule ^/var/[^/]+/cache/texttoimage/.* - [L] Rewriterule ^/design/[^/]+/(stylesheets|images|javascript)/.* - [L] Rewriterule ^/share/icons/.* - [L] Rewriterule ^/extension/[^/]+/design/[^/]+/(stylesheets|images| javascripts?)/.* - [L] Rewriterule ^/packages/styles/.+/ (stylesheets|images|javascript)/[^/]+/.* - [L] RewriteRule ^/packages/styles/.+/thumbnail/.* - [L] RewriteRule ^/favicon\.ico - [L] RewriteRule ^/robots\.txt - [L] # Uncomment the following lines when using popup style debug. # RewriteRule ^/var/cache/debug\.html.* - [L] # RewriteRule ^/var/[^/]+/cache/debug\.html.* - [L] RewriteRule .* /index.php </IfModule> DocumentRoot [PATH_TO_EZPUBLISH] ServerName [SERVER_NAME] ServerAlias [SERVER_ALIAS] </VirtualHost>
The following table explains the variables as referred to in the code above:
| Variable | Description | Project value |
|---|---|---|
| [IP_ADDRESS] | The IP address of the virtual host. Apache allows the use of a wildcards here ("*"). | localhost |
| [PORT] | The port on which the web server listens for incoming requests. This is an optional setting. The default port is 80. The combination of an IP address and a port is often referred to as a socket. Apache allows the use of a wildcards here ("*"). | * |
| [PATH_TO_ EZPUBLISH] | Path to the directory that contains eZ Publish. This must be the full path. | /var/www/
packtmediaproject |
| [SERVER_ NAME] | The host or the IP address that Apache should look for. If a match is found, the virtual host settings will be used. | packtmediaproject |
| [SERVER_ ALIAS] |
Additional hosts/IP addresses that Apache should look for. If a match is found, the virtual host settings will be used. |
| Please note that the mod_rewrite module must be enabled in
httpd.conf in order to use the Rewrite Rules. |
The NameVirtualHost setting might already exist in the default configuration. Defining a new one will result in a conflict. If Apache reports errors such as "NameVirtualHost [IP_ADDRESS] has no VirtualHosts" or "Mixing * ports and non-* ports with a NameVirtualHost address is not supported", try skipping the NameVirtualHost line. For more information about the NameVirtualHost directive, see: http://httpd.apache.org/docs/1.3/mod/core.html#namevirtualhost.
If the ServerName is not a registered domain, you will need to add the record to the file /etc/hosts, so that the system DNS can resolve it.Open the file /etc/hosts and insert the following code at the end of file:
127.0.0.1 packtmediaproject
[edit] Image settings
In order to scale, convert, or modify images, eZ Publish needs to make use of an image conversion system. Either of the following software packages (both are free) can be used:
- GD2 (comes with PHP)
- ImageMagick (http://www.imagemagick.org)
ImageMagick supports more formats than GD2 and usually produces better results (better scaling, and much more). The setup wizard will automatically detect the pre-installed image conversion system(s).
The installation and setup of required software solutions (outlined above) is far beyond the scope of this document. Please refer to the eZ Publish homepage and the relevant documentation for the different software solutions.
[edit] Cron jobs
Some features of eZ Publish depend on the maintenance script that takes care of various tasks behind the scenes. This script is located in the root of the eZ Publish directory and should be executed at regular intervals. The script is called runcronjobs.php. Among other things, it processes workflows, checks and validates URLs, sends out notification emails, and so on. Although eZ Publish works without a periodic execution of runcronjobs.php, it is still recommended that you have it running in the background. Some features, for example the notification system, will not work if the script is not running.
The most common practice is to instruct the operating system to automatically run the script every 30-60 minutes. However, some tasks should be executed more frequently than others, and thus it is a good idea to divide the cronjobs into groups/sets, and run them separately.
In the coming tutorials, we'll set up some cronjobs: clear draft, start workflow event, and notification.
[edit] Configuration files
The default configuration files end with a .ini extension and are located in the settings directory. Each file controls the behavior of a specific part of the system. The main and the most important configuration file is called site.ini. Among other things, this file tells eZ Publish which database, design, and so on, should be used. The default configuration files contain all of the possible directives (with default settings), along with brief explanations. These files should only be used for reference, and should never be modified.
An eZ Publish configuration file is divided into blocks. Each block contains a collection of settings. For example:
... # This line contains a comment. [DatabaseSettings] Server=localhost User=allman Password=qwerty Socket=disabled SQLOutput=enabled # This line contains another comment. [ExtensionSettings] ActiveExtensions[]=ezdhtml ActiveExtensions[]=ezpaypal ...
The example above shows two blocks: DatabaseSettings and ExtensionSettings. Each block has several sub-settings, which control the behavior of the system. A setting can usually be set to enabled/disabled, a string of text, or an array of strings. If the name of the setting ends with a pair of square brackets, it means that the
setting accepts an array of values. In the example above, the ActiveExtensions setting tells eZ Publish to use two different extensions: ezdhtml and ezpaypal. Lines starting with a hash mark (#) are treated as comments.
As pointed out earlier, the default configuration files should never be modified because they will most likely be overwritten by a new set of files during an upgrade. Because of this, custom configuration settings must be placed elsewhere. Global configuration overrides can be placed in the /settings/override directory. The settings of the configuration files located in this directory will override the default settings. The name of the configuration files in the override directory must end with extension .ini.append.php or .php.
If an override configuration file exists with both extensions, eZ Publish will process the one with the .ini.append.php extension. The .php extension is more secure, because will be processed by the web server as a PHP script. If someone attempts
to read it directly using browser software, the server will not display the contents because the configuration settings are commented out. This method will prevent the disclosure of secure information such as the database username and password.
In order for this to work, the contents of the configuration file must be encapsulated by a pair of PHP comment markers: /* and */. The following example shows how an override (for example test.ini.append.php) should be set up:
<?php /* #?ini charset="utf-8"? # These are my example settings [ExampleSettings] ExampleSettingOne=enabled ExampleSettingTwo=disabled ... */ ?>
The charset directive reveals the character set that was used to construct the .ini file (usually UTF-8).
[edit] The setup wizard
We have now prepared the system and downloaded the required software but we have not yet used the software. We have to do the last step in order to start creating our magazine site.
Let's open a browser and enter the URL http://packtmediaproject. The setup wizard, provided by eZ Publish will start to configure our new site. Following the setup wizard is quite easy and we'll take a look at all of the pages that we have to visit before using the CMS.
Welcome to eZ Publish
The first page we will see is the welcome page for eZ Publish. Here we can see the welcome message for the installation, and we can click on Next to proceed to the actual installation.
[edit] System check
If you forget some aspect of configuration or your system needs some more fixes, the system check page lists all the detected issues. Follow the instructions, one-by-one, to fix the problems. Every time you click on the Next button, the wizard will run the System Check again, and if no more issues are found you can continue.
Sometimes it is necessary to ignore a configuration; in this case you need to select the Ignore this test checkbox as seen in the next screenshot:
The Finetune button is used for tuning the whole system to work best with the CMS. This procedure is optional and it should only be used if you have a highly-customized PHP configuration.
Email settings
After the system has been configured, we need to set up our outgoing email settings. We assume you shall want to use the sendmail SMTP server, which is usually installed on all main Linux distributions.
If your server is configured to not use sendmail (or some compatible MTAs such as Postfix or Qmail) you'll have to use SMTP configuration. In this case, you have to specify the SMTP server name (or its IP address) and the user and password (if needed) to send outgoing emails.
[edit] Choose a database
After we finish configuring all of the email stuff, we have to move on to the database side.
In this step we can choose our database engine. eZ Publish supports MySQL, MySQLi and PostgreSQL. In the list are present only the engines configured with our PHP installation.
If you have configured only MySQL as the PHP database, this page will not be shown.
If the PHP is configured to use mysqli extensions, then the setup wizard will suggest that you use this. This choice is recommended, as it guarantees good performance.
[edit] Database initialization
After we have chosen our DBMS, we need to provide the necessary information for the system to connect to the database.
To set up our site we have to use localhost as the server name, packname as username, and packtpwd (or an alternative password, if you prefer) for the password.
When the Next button is clicked, the wizard will try to connect to the database. If it fails, then the database initialization page will be shown again.
[edit] Language support
The language support page allows you to choose the primary language for the eZ Publish installation.
We can also choose other additional languages (in our example we have chosen Italian, French, and English) that will be used to translate content.
The system allows us to reconfigure and add languages at any time, so if you add more languages you can change these settings after the complete installation. It is very important to note that choosing a primary language will also set up the localization of the CMF. So, for example, the type of default date format will change from US format to an Italian one.
[edit] Site packages
As we said before, eZ Publish has some site packages bundled by default. In this section of the wizard, we can select the main package that we will use to develop our site.
All of the packages can be installed and used together, but we don't suggest that you do this. Instead, focus on a single package, and if really necessary extend this through the use of components and extensions.
For our Magazine site we will use the eZ Webin extension, which is bundled in the Website Interface packages.
It is important to allow the server to download content from the Internet. This will be necessary should you want to download all of the packages needed by the eZ Webin extension. If your server is behind a firewall then you will have to create a file called site.ini.append.php in the setting/override directory, and add the following lines to it:
[ProxySettings] ProxyServer=proxy.domain.com:8080 User=proxyUser Password=proxyPassword
Replace proxy.domain.com:8080 with the actual proxy address, and restart the Setup Wizard.
When we select a non-English default language, it is possible that the site package that we install will have no support. In this case, the setup wizard allows three kinds of actions:
1. Map the package language to one of our choices, so that the missing text will be replaced with the default one. 2. Create a new language. 3. Don't create the content for the language.
In our case, we decide to map all of the existing English (UK) content to English (American). Then (if needed) we can update this, according to our needs, later on.
[edit] Site access configuration
In this step, we can select the access method we want to use in eZ Publish. This is a very important step and the usage of the CMS strictly inherits from this choice.
The system allows three possible choices:
- URL (recommended): This is the default, and recommended, value. It doesn't require any particular configuration. It simply uses an HTTP request to the main index.php file to facilitate site access.
- Port:The Port configuration is used to map a site to a particular port on our server, for example http://packmediaproject:81/. To use this parameter, it is necessary to change the Apache configuration and handle all of the possible conflicts with proxies and the firewall.
- Hostname: This last option is used, for example, to map the site to a unique hostname (for example, a subdomain on the backend). As with the Port option, it a web server and a DNS configuration is necessary.
[edit] Site details
On this page, the wizard will show all of the set-up information. Moreover it shows the databases installed on our system.
Now, we have to select the packmediaproject database, which we have previously created. Do this by selecting it from the drop-down box and clicking on the Refresh button.
If the database is not empty, the wizard will ask what you want to do:
- Keep the existing data and add the new tables
- Choose another database
- Remove the existing data
- Leave the data as it is (do not add the new tables)
[edit] Site security
This is the last actual configuration step. Here, we will add base security to our system to prevent it from being used by unknown users.
To do this, we only need to fill the form with the data that will be used by the administrator. It's very important to specify a real email address so that it is possible to change the password if forgotten.
[edit] Site registration
Site registration is an optional step that allows eZ System to know if sites using eZ Publish are online or not.
All of the sent data will be confidential, and used by eZ System's staff to check the different types of platforms used for eZ Publish. Feel free to send or not send the notification.
[edit] Finished
Now our site is online and we can start working on it.
[edit] Additional References
- For instructions on advanced techniques for Creating Designs using eZ Publish, click here
- For instructions on Troubleshooting eZ publish, click here
- For instructions on advanced techniques for Debugging eZ Publish, click here
- For instructions on Installing eZ publish, click here
[edit] Source
The source of this content is Chapter 1: Installing eZ publish 4 of eZ Publish 4: Enterprise Web Sites Step-by-Step by Francesco Fullone, Francesco Trucchia (Packt Publishing, 2009).
