I wanted to set up a development server to test more intensive PHP applications, and also a sandbox so I opted to get a typical web server stack on Solaris.

First thing's first: grab nginx from  Cool Stack page. There's some great packages there, like Apache, PHP and MySQL all in one. I decided to go with nginx for something light and something new. 

The binary for nginx is  /opt/coolstack/nginx/sbin/nginx so be sure to set your configuration in /opt/coolstack/nginx/conf/nginx.conf (pretty straight forward). Be sure to enable the FastCGI section in the config file!

Next thing is PHP. Pretty standard here. Get the source from php.net, configure and install. I ran ./configure with --prefix=/usr/local/php5 --enable-fastcg=/usr/local --enable-force-cgi-redirect --enable-cli --enable-zip --with-layout=GNU --with-regex=php --with-zlib=/usr/local --with-curl=/usr/local --enable-exif --with-gd 

Once that's done, set up your php.ini in /usr/local/php5/etc And of course, add cgi.fix_pathinfo = 1 to the end of the file. Now, for everything to piece together, you'll need FastCGI to parse PHP with nginx (as far as I know). Grab FastCGI from here and the standard compile commands.

Now, nginx was running but I couldn't get it to parse PHP. nginx was listening for port 9000 for FastCGI but it wasn't there. After a bit of Googling I found spawn-cgi, as it comes with lighttpd by default. Anyway, get spawn-cgi and install.

Finally, spawn FastCGI with:
/usr/local/bin/spawn-fcgi -a -p 9000 -u www-data -f /usr/local/php5/bin/php-cgi

(You'll have to create user www-data if it doesn't exist).

And that's about it. I now have Proftpd on there, and it's running quite smoothly indeed. Any comments or ideas are welcome.


I have been doing some research in the compile options --with-layout=GNU and --with-regex=php but I had no lock finding any useful information.

Can you please explain to me in detail why people use --with-layout=GNU and --with-regex=php?

I would greatly appreciate that. Thanks!

Good question (as I don't know either). I ran ./configure --help in the php source and grep''d accordingly.
It says that --with-layout specifies how the installed  files are laid out and --with-regex specifies which library type. 

Thanks for your reply.

I've read that description before but it does not really answer my question. What files is it referring to? What is the difference between GNU and PHP layout?