Thu 11 May 2006
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.
RSS feed for comments on this post. TrackBack this post
May 12th, 2006 at 8:06 am
Sorry, but I thinks that there is some misundestanding… nginx supports FastCGI and can directly use PHP without any third-party software. The only thing you need is some software to run php as fastcgi and ___I___ am using spawn-fcgi from lighttpd, but ypu can try to use google://php+fcgi to find another methods.
May 12th, 2006 at 5:11 pm
As far as I understand from the doc of nginx, it proxys request to php script to a dedicated fastcgi server, which is another program other than nginx itself.
May 13th, 2006 at 11:48 am
Sorry, but AFAIU you don’t understand what FastCGI is… FastCGI software always runs separately from web server and communicates with them via unix sockets or tcp-sockets. Nginx fully supports both methods.
May 13th, 2006 at 3:37 pm
My point is that, nginx does not provide a fastcgi server as part of it, instead it relys on other programs to act as the fastcgi server. While on the other hand, lighthttpd provide a mod_fastcgi to support it without any other requirements.
December 25th, 2006 at 8:23 pm
hi!
how far or long is your patch coming?
December 25th, 2006 at 8:41 pm
ok, I will blog about the solution (no need to patch ez, in fact)
December 26th, 2006 at 10:49 pm
eZ publish with fastcgi (lighttpd)…
Sometime ago I talked about
making eZ publish 3.x happy with fastcgi. The original approach is to patch
eZ Publish so that it works with fastcgi correctly. However, Xavier Dutoit pointed out that, given some special treatment in lighttpd config fil…