It is well known that eZ publish does not play well with CGI, thus it can not work properly with some minority web servers, such as lighttpd and nignx (and I managed to google out an English blog about how to configure nignx) which only support php in CGI mode. However after reading a thread in eZ forum, I wanted to give it a shoot.

First, I have to decid which of the two minority web server I’d like to try. Although personally I prefer the cool name of nignx (pronounced as engine X), it does not support php directly: instead it depends on lighttpd to handle php request. It is obvious I have to go with lighttpd to run eZ.

After some painful googling about howto make lighttpd work with fastcgi/php etc, I finnally managed to work out a way to get through the mess, and make eZ Publish work with CGI as smoothly as in php apache mod.

Install Lighttpd

First, install lighttpd. As a gentooer, this is pretty straightforward:

emerge lighttpd

Of course, in order to install the latest version available in portage, I use ~x86 keyword for the package  www-servers/lighttpd (In fact, latest version for lighttpd is 1.4.11, while the newest one in portage is 1.4.10, but I think 1.4.10 is reasonable new and stick with it). And do remember to enable the php use.

The configure for PHP is in /etc/lighttpd/mod_fastcgi.conf, and it should be ok out of the box, . However for those not in the hand of gentoo, you can find the config file in the attachment.

In /etc/lighttpd/lighttpd.conf, the main config file for lighttpd, I enabed these modules: mod_rewrite, mod_redirect, mod_alias, mod_access and mod_accesslog.

That’s pretty all of configuration it requires, now we can stop apache (I use 1.3.34 now) and start our brand new lighttpd.

Work with eZ publish

The setup of the eZ I test is not a virtual host one: it is a url based. I can access the homepage of it with lighttpd successfully, but all the urls are something like index.php?/siteaccess/bla/bla, which is not nice and it does not compatible with eZ working in none CGI mode.

I tried to access index.php/siteaccess/bla/bla directly (without a question mark after index.php), and it did not complain about no input file or similar, instead eZ loaded but eZ complained that ez38 is not a recongized module (the eZ is installed in /ez38 subdir).

After checking the phpinfo() output, I figured that even in CGI mode, it is possible to obtain the path info (the string appending after index.php) without using query string. In fact, just modifying one file in eZ core is enough to make it work with CGI: lib/ezutils/classes/ezsys.php.

I will definitely release the patch after I tidy it up and make sure it can still work in none CGI mode.

Ah, in case you wonder, yes, it is possible to use eaccelerator or similar with lighttpd/fastcgi/php. I am using it in my test server without any problems.