Partial Content

Working with eZ Publish 5 - Installation


I'm assuming that you already have a decent Apache, Mysql, and PHP setup running and configured for setting up virtual hosts. You'll want to have at least PHP 5.3.8 and MySQL 5.0.51, and some version of ImageMagick. On a Mac, Homebrew is a quick way to get most of this up and running. Vagrant is also a great way to provide a performant virtual environment to use as a development sandbox.

Most of these setup steps are covered in more detail and variety by the eZ Publish online documentation.


First off, download eZ Publish Community Edition 2012.12, and unzip it into a folder. Here's what you get:

Default eZ 5 File Structure

So what are we looking at here? Let's talk about a couple of these pieces: 

  • composer.* - These are files for using the composer PHP dependency management system. It's very handy for maintaining projects with a lot of third-party libraries, but we'll ignore it for this tutorial so we're all using the same version of everything.
  • ezpublish - This is where the config, cache, and some logging components of eZ Publish live (this directory is called 'app' in most Symfony installs)
  • ezpublish_legacy - Take a peek in here - Look, it's our old friend eZ Publish 4! This is a full eZ 4 install, slightly updated.
  • src- This is where we'll be building out our code, in structures called bundles. There's a bundle already there, the EzSystemsDemoBundle, that implements a basic surround in symfony.
  • vendor - This is where most of the supporting third-party frameworks live, including components of Symfony and eZ Publish.
  • web - This is where you'll point Apache to as a web root. We'll set up Rewrite rules shortly to send most of our traffic to index.php, which is the endpoint that handles all requests to Symfony.

Apache Config

Here's a basic apache config to use for development - don't copy this one to your production environment. 

<VirtualHost *:80>     DocumentRoot [PATH_TO_EZPUBLISH]/web/    ServerName [SERVER_NAME]    ServerAlias [SERVER_ALIAS]    <Directory [PATH_TO_EZPUBLISH]/web>        Options FollowSymLinks        AllowOverride None
        Allow From All    </Directory>     # Configures some PHP settings - most of these should be your defaults anyway    <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     RewriteEngine On    # CVE-2012-6432    RewriteRule ^/_internal - [R=403,L]    # Send requests for version 1 of eZ's REST API to the legacy code    RewriteRule ^/api/[^/]+/v1/ /index_rest.php [L]    # Don't rewrite some paths used by legacy eZ Publish    RewriteRule ^/var/([^/]+/)?storage/images(-versioned)?/.* - [L]    RewriteRule ^/var/([^/]+/)?cache/(texttoimage|public)/.* - [L]    RewriteRule ^/design/[^/]+/(stylesheets|images|javascript|fonts)/.* - [L]    RewriteRule ^/share/icons/.* - [L]    RewriteRule ^/extension/[^/]+/design/[^/]+/(stylesheets|flash|images|lib|javascripts?)/.* - [L]    RewriteRule ^/packages/styles/.+/(stylesheets|images|javascript)/[^/]+/.* - [L]    RewriteRule ^/packages/styles/.+/thumbnail/.* - [L]    RewriteRule ^/var/storage/packages/.* - [L]    # Don't rewrite for some web-standard files    RewriteRule ^/favicon\.ico - [L]    RewriteRule ^/robots\.txt - [L]    RewriteRule ^/w3c/p3p\.xml - [L]    # Don't rewrite for some assets in bundles    RewriteRule ^/bundles/ - [L]    # Send everything else to the development version of the router    RewriteRule .* /index_dev.php </VirtualHost>

Note that you need to replace [PATH_TO_EZPUBLISH], [SERVER_NAME], and [SERVER_ALIAS] with your own values. 


You don't have to do much configuration for MySQL, but you should create a new database to work with, and set up a user name and password.

CREATE DATABASE partialcontent CHARSET utf8;
GRANT ALL ON partialcontent.* TO <a href="mailto:pcdb_user@localhost">pcdb_user@localhost</a> identified by 'YOUR_PASSWORD_HERE';


First, make sure that the following folders and all their contents are writable by the web server:

  • ezpublish/cache
  • ezpublish/logs
  • ezpublish/config
  • ezpublish_legacy/design
  • ezpublish_legacy/extension
  • ezpublish_legacy/settings
  • ezpublish_legacy/var

Next, we need to make sure all of the static assets needed by the system (javascript, css, images, etc) are available under the 'web' folder. Fortunately, eZ provides Symfony console commands to take care of this for us. Go to the root of your project in your console (the directory that contains 'ezpublish', 'ezpublish_legacy', 'web', etc) and run this command: 

php ezpublish/console 

What you'll see is a help text and a list of available commands. The ones we're looking for are the ones to install assets. Go ahead and run these two:

php ezpublish/console assets:install --symlink
php ezpublish/console ezpublish:legacy:assets_install --symlink

There are a lot more things that the console can do for us, but we'll come back to it later. For now, go ahead and access the site in your web browser.

If you played your cards right, you should have something: 

Screenshot of eZ Publish setup wizard

If you've worked with eZ Publish before, this will look pretty familiar: It's the eZ Publish setup wizard. Follow the steps of the wizard to set up your site. I'd recommend making a couple of choices so that you can follow along with the tutorial: 

  • Enter your DB credentials that you defined earlier in the 'database initialization' step.
  • Under 'Site Package', select 'eZ Publish Demo Site' (this step takes a while and requires an internet connection as additional features are downloaded)
  • For 'Site Access Configuration', select 'URL'
  • Under 'Site Details', leave the 'user path' and 'admin path' as-is, but make sure to select the database you created earlier.

Once you've completed the wizard, you should have a running site!