* also, once you install Zend Server, your "native" PHP installation packages from your distro will be removed, since those are obsolete now

* also, once you install Zend Server, your "native" PHP installation packages from your distro will be removed, since those are obsolete now

* on the upside, Zend provides repositories for Redhat/CentOS as well as Debian/Ubuntu, hence whenever you update your system, the Zend Server packages including your Zend Framework will be updated with your regular update process, e.g. <code>aptitude full-upgrade</code> or <code>yum update</code>. That is really nice, especially if you are using something like <code>apticron</code>. No more out-dated PHP or Zend Framework libraries. Nice!

* on the upside, Zend provides repositories for Redhat/CentOS as well as Debian/Ubuntu, hence whenever you update your system, the Zend Server packages including your Zend Framework will be updated with your regular update process, e.g. <code>aptitude full-upgrade</code> or <code>yum update</code>. That is really nice, especially if you are using something like <code>apticron</code>. No more out-dated PHP or Zend Framework libraries. Nice!

−

* starting with PHP 5.3 it seems not to be cool anymore (see the comments [http://library.linode.com/web-servers/nginx/php-fastcgi/ubuntu-10.10-maverick here] ) to use <code>spawn-fcgi</code>. The new cool kid apparently is <code>php-fpm</code>. But that requires patching of PHP 5.3 itself - and I do not think that Zend already supports this. Therefore, I will stick with <code>spawn-fcgi</code> for now.

+

* starting with PHP 5.3 it seems not to be cool anymore (see the comments [http://library.linode.com/web-servers/nginx/php-fastcgi/ubuntu-10.10-maverick here] ) to use <code>spawn-fcgi</code>. The new cool kid apparently is <code>php-fpm</code>.

Allright, with no further ado, here we go ...

Allright, with no further ado, here we go ...

Revision as of 11:06, 30 April 2013

Contents

Synopsis

The Zend Framework is a Model-View-Controller (MVC) framework and provides all the components required for most web applications in a single distribution. It can either be added to your existing PHP stack or comes included with the free and paid-for version of Zend Server.

You can download the latest version of Zend Framework and extract the contents; make a note of where you have done so.
Optionally, you can add the path to the library/ subdirectory of the archive to your php.ini's include_path setting.
That's it! Zend Framework is now installed and ready to use.

If that is your preference, you can stop reading now and read-up on how to configure nginx to work directly with PHP FastCGI

Alternatively, Zend Framework also comes packaged with both, the free and paid-for edition of Zend Server:

Zend Server includes a production-ready, tested stack that incorporates PHP, Zend Framework, required extensions and drivers - all installed through RPM/DEB on Linux or MSI on Windows. Zend Server also support IBM i.

A few of my observations for your consideration

the number of additional packages and files from Zend are rather heavy-weight; you not only get PHP 5.3 (5.2 is also supported) but also the Zend Framework, Apache 2.2 and the Zend Server Administration GUI

also, once you install Zend Server, your "native" PHP installation packages from your distro will be removed, since those are obsolete now

on the upside, Zend provides repositories for Redhat/CentOS as well as Debian/Ubuntu, hence whenever you update your system, the Zend Server packages including your Zend Framework will be updated with your regular update process, e.g. aptitude full-upgrade or yum update. That is really nice, especially if you are using something like apticron. No more out-dated PHP or Zend Framework libraries. Nice!

starting with PHP 5.3 it seems not to be cool anymore (see the comments here ) to use spawn-fcgi. The new cool kid apparently is php-fpm.

Allright, with no further ado, here we go ...

Installation instructions

Again, since I am on Ubuntu, I was following the installations instructions for the DEB installation. This means you have to update /etc/apt/sources.list and import the GPG key for Zend's repository, so make sure you read the instructions carefully!

The following commands install the Zend Server Community Edition and stop both, the Apache 2.2 and Zend Server GUI afterwards

Once that is done, you want to create a custom php-fastcgi script for Zend Server Community Edition that nginx can use to forward PHP template processing to, just as you would do for a regular PHP installation.

Create the file /etc/init.d/php-fastcgi as root and put the following content in it:

You notice, we are lifting various settings from the Zend installation (/etc/zce.rc) that will have some impact on the configuration of nginx. Particularly, I decided to use Unix sockets for performance reasons since I am on the same machine with both, nginx and the Zend Server and Framework. The rest of the file is heavily inspired by the start and stop scripts for the built-in Zend GUI (based on lighttpd) which also uses spawn-cgi!!

Next up, make the file executable and add it to your servers regular environment for controlling system daemons:

In order to avoid port conflicts and save system resources, and of course we do not need Apache anymore, prevent Apache 2.2 and Zend GUI (lighttpd) from starting automatically.

cd /etc/init.d
sudo update-rc.d -f zend-server remove

Time for nginx

Now, all that is left is to configure nginx to forward all PHP requests to our newly installed Zend Server
We are going to lean heavily on the regular instructions for PHP FastCGI. Just keep in mind that we are using Unix sockets, and not binding the Zend Sever PHP CGI process to a TCP/IP port. Therefore, this is what our configuration for PHP looks like. Also note: this is just the part in regards to plain PHP, most likely you would also want to make sure, no requests will be forwarded to Zend Server for any of your static or cached content!!