This won’t be a very long article, it will instead be the first article in a series about eZ Publish CMS. eZ Publish is a very robust open-source CMS written in PHP, so there’s no point in trying to encompass it in one article. This will be an introduction to the eZ Publish CMS and we’ll get deeper into its functionalities in some later blog posts.

The need for CMS

I’m sure you’re aware of what a CMS is and how it can help you and your site be more successful. Just in case you’re a newbie in Web Development, let me just say that a CMS can do wonders. CMS (Content Management System) can help you to create a website in a matter of minutes and then you can use it to edit your website content and add new articles.

CMS is basically just what the name says. Application for content management. It enables the creation and modification of content without programming knowledge or specialized applications for content upload. I’m sure you can see by now that creating a website based on CMS is a great idea.

OK, but why eZ Publish?

I have to be fair and say that the name “eZ Publish” is somewhat misleading. eZ Publish is not very easy, especially for newbies. If you’re looking for a very easy way to start a blog or a very simple website, eZ Publish is probably not something you would want. Instead, take a look at WordPress.

What eZ Publish does offer is a very robust and flexible framework for developing, deploying and editing website content. It is a complete solution for any type of project you might be developing. Let’s just list a few cool eZ Publish features:

  • Content Versions
    Once you edit some content on your website you automatically create a new version of that content. For example, you edit an article. If you don’t like what you did, simply revert to an older version. If you start editing an article no other user will be able to edit that same version until you’re done!
  • Multi-language support
    Add new language on the website via eZ Publish site access. Via the admin interface simply create a new document in any site language or create a new translation for the existing article. Users will be presented with the correct article translation automatically.
  • Custom content classes
    Want to present info about car models? Simply create a Car custom class via the Admin interface with the engine, max speed, manufacturer and whatnot properties and then create “Cars” as easily as you created articles before. You can even add a “Manufacturer” class and link them with the cars. All via Admin Interface! No need to edit the database manually or add new tables!
  • Content search
    Integrate eZ Publish search into your website to search your content. No development is necessary.
  • User management
    Group users into groups. Control what they can or can’t see, what they can or can’t do, and what functionalities and classes are available to them.
  • Extensions
    Need something that eZ Publish doesn’t have? Download a new extension from the extensions repository that covers your need, or even creates your own extension.
  • Stand-alone librariesMany libraries can be used for general PHP project development.

By now I’m sure you’re convinced to at least try eZ Publish for a while in your free time. Well, that’s great. So, let’s set up your hosting environment, and then download and install eZ Publish.

How to get eZ Publish?

It’s easy! Just go to share.ez.no and download the latest full version from there.

Look for the ezpublishcommunity-4.4.0-with_ezc-gpl.zip file and download it. Then, extract it to a folder of your choice. Remember that folder, we’ll need it later.

Local environment setup

As you already know, in order to run eZ Publish and PHP in general you need to have a hosting server software, like Apache or IIS and MySQL server. You can, of course, download and install Apache and MySQL separately, but in this day and age, I say: why bother? There are a lot of great solutions that install everything y need at the same time, like XAMPPZend Server or even Microsoft’s Web Platform Installer, which is great to use if you plan to develop ASP.NET websites as well.

NOTE: If you used Web Platform Installer and didn’t install everything needed for PHP on IIS you might get an error stating: Handler “PHP53_via_FastCGI” has a bad module “FastCgiModule” in its module list

Luckily, it’s easy to fix, and the instructions are available on the PHP site: Installation on Windows systems – Microsoft IIS 7.0 and later

Once you installed your local environment, let’s set it up:

1. The database

First, let’s create a database for eZ Publish to use. Why the database first? Because I want to leave virtual hosts for the end, as I’ll be covering both Apache and IIS and I don’t want you to get lost, that’s why. 🙂

As you already know, it’s very easy to create a database. If you installed XAMPP or Zend you should already have phpMyAdmin, so you can use it to create the database. Or use some desktop MySQL front-end, such as free HeidiSQL, which I use personally.

Anyway, whatever you use, just create a new database named ezpublish with the utf8_general_cicollation. That’s all you need to do regarding the database. Let’s move on.

2. The hosts file

Next, we’ll add an entry into the Windows hosts file. Why? So when we try to access the ezpublish.local address the system knows where it is.

The hosts file is located in X:\WINDOWS\system32\drivers\etc\ path. If you’re running Windows Vista or Windows 7 you’ll need to run your favourite text editor (Notepad will do) as an Administrator to be able to make changes to that file.

Add the following line to the hosts file and save it:

127.0.0.1   ezpublish.local

Now, we’ll create a virtual host for our eZ Publish instance and here’s how to do that:

3.1. If you use Apache:

Go to the directory where you installed Apache. If you used XAMPP it should be something similar to X:\xampp\apache\conf\extra and if you used Zend server it should be something like X:\Program Files\Zend\Apache2.2\conf\extra. Inside it, there’s a httpd-vhosts.conf file. Using your favourite text editor open the file httpd-vhosts.conf.

At the end of that file add the following lines:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost.com
    DocumentRoot "C:\xampp\htdocs"
    ServerName localhost
    ServerAlias localhost
</VirtualHost>
 
<VirtualHost *:80>
    ServerAdmin you@youremail.com
    DocumentRoot "D:\Documents\Web Work\Eclipse Workspace\ezpublish"
    ServerName ezpublish.local
    ServerAlias ezpublish.local
</VirtualHost>

The first part is needed because once you add a virtual host you won’t be able to access localhost anymore, and the second part is actually the virtual host used for eZ Publish. Make sure you correctly write the path to the folder where you extracted eZ Publish files.

Now restart the Apache server so that configuration gets loaded.

3.2. If you use IIS:

Run Internet Information Services Manager. It’s located in the administrative tools. Expand the server portion (which contains your computer’s name) and go to sites. On the right side of the toolbar click the Add web Site… button. A dialogue box will open:

For the IP address enter 127.0.0.1, name the site eZ Publish or something, for Physical Path choose the folder where you unpacked the eZ Publish zip file and for hostname enter ezpublish.local. Click OK and start the website.

OK, now we’re ready to rock!

Installation

Now, let’s install eZ Publish. Open your favourite browser and in the address bar type: http://ezpublish.local. The installation screen will show:

It may say that your system is not optimal and in that case, you can click the Finetune button to see the issues. If you want, you can correct them, but you don’t really have to. eZ Publish will function correctly, it just may not have all the features.

Once you selected the installation language and optionally fine-tuned your setup click Next.

This screen will ask you to enter your SMTP settings which are used for mail functionality in eZ Publish. You can enter them there or you can also enter them later in the configuration file. NOTE that you may also be presented with an option to send the mail via sendmail if it’s available on the server. The sendmail option is usually available on UNIX.

Once you configure your e-mail settings (or decide to skip this step) click Next.

In this step, you’ll be asked which database driver eZ Publish will use. You’ll only be presented with the drivers’ eZ Publish detects available on your system. For instance, on my system I only have the options of MySQL or MySQL Improved, so select MySQL Improved and click Next.

Here you need to enter the information needed so that eZ Publish can access the database. Simply enter your username and password and click Next. If you entered the wrong username or password, eZ Publish will stay on this screen and present you with an error. Once you entered the correct username and password combination click Next again. This screen will show:

In this screen use the radio button to select the default language for your installation and check boxes for additional languages/translations you may want on your site. NOTE that you can also add languages later via the Admin interface. So, select your options and click Next. This screen will show:

In this step, you can choose some of the pre-configured site types based on what the authors think eZ Publish might be most used for. Select a package, or if you wish to start from scratch select the plain site and click Next. NOTE that you should only start from scratch if you’re an advanced user or are willing to get right into it. For now, I recommend that you choose the Website interface because it offers you some classes and demos you can use to start working with eZ Publish.

On this screen you’ll simply be informed what package you choose and that the download was successful. So, click Next. If the languages we selected for this installation don’t match the language in the package you chose, you’ll be presented with a screen like this:

This screen means that there are languages in the package which aren’t selected for use on the site. You can either:

  • Skip content – content simply won’t be used
  • Create language – add this language to the site and create content for it based on the package.
  • Map to some other language – use the content from the demo to create content in other languages

Anyway, choose an option and click Next. You’ll be presented with this screen:

Basically, the setup asks you: how should the content be accessed and presents you with three options:

  • URL – the site is accessed based on an URL.
  • Port-based on a port. The port number is specified on the URL (you might see this, looks like for example http://localhost:8000/)
  • Hostname – each site is assigned a hostname. This requires the configuration of the DNS server.

Simply select the URL method because it doesn’t require additional configuration and let’s move on.

Simply enter a title for your site, user and admin paths. Also, don’t forget to choose the ezpublish database we created and click Next.

On this screen you simply need to enter the data about the administrator user:

eZ Publish administrator user setup

Once you entered the configuration, click Next. eZPublish might recommend to you that you secure your site by copying .htaccess_root to the .htaccess file. If you use Apache you should do that. If you use IIS, skip this step and we’ll deal with it later. OK, now we can move on:

This is only a suggestion to send the registration information, you can unselect the checkbox and click Next and wait for the page to load. Note that you should only click the button once. And as the next screen says, we’re finished with the installation!

Screen that says eZ Publish installation is finished

On the finished screen you have the links to the user and to the admin site, so feel free to visit them now and see what they look like.

Additional: eZ Publish virtual host mode and URL rewriting under IIS

In order to run eZ Publish in Virtual host mode under IIS correctly you need to have URL Rewrite installed. If you don’t have it you can install it via Web Platform Installer. Once you have URL Rewrite installed, go to the folder where you unpacked eZ Publish and open the site.ini file that’s located inside a settings folder.

In your editor use the search function to find the ForceVirtualHost parameter. It’s located inside a [SiteAccessSettings] section. When you find it, change its value from false to true.

[SiteAccessSettings]
# Set to true if you want to force VirtualHost mode (with Rewrite Rules in apache)
# If this is set to true nonVirtualHost mode will not work correctly
ForceVirtualHost=true

When you save the file and refresh the page you’ll get an error. If you remove everything after http://ezpublish.local/ the page will load, but none of the links will work under IIS, so you’ll only be able to see the index page, and any other link will get you a 404 error.

That’s because IIS doesn’t understand .htaccess files eZ Publish uses, so it won’t matter to it even if you have .htaccess file. Luckily, there’s an easy solution:

Open Internet Information Services manager. Under sites select the eZ Publish site we created earlier. Then open URL Rewrite.

Click on the Import rules… button. A dialogue box will open where you can enter the rules to import. Simply copy all the text from .htaccess file in eZ Publish directory to that dialogue:

Then on the right side click Apply. Then you can go back to Rules to verify the rules are created. Then you can close IIS Manager.

If you refresh the website now you’ll see that the URLs work!

OK, that’s it for this article, until next time I wish you all the best.