Check out the Red programming language from the same author

HOW-TO make Cheyenne work with PHP for non-Windows OS

Nenad Rakocevic - Softinnov
21-Dec-2007 20:34:04 GMT

Article #15
Main page || Index || 1 Comment


The purpose of the following patch is to make FastCGI in PHP work the same on all OSes.

1) If you have PHP v5.2.1 or higher with sources, you can skip 2) & 3) else :
2) Download latest PHP sources from http://www.php.net/downloads.php
3) Untar the archive anywhere you want
4) Go to PHP install folder
5) Patching PHP source :

Open a REBOL console, then :
;---- cut'n paste the following code in REBOL's console ----

patch-php: has [buffer pos][
	target: %sapi/cgi/fastcgi.c
	if none? attempt [buffer: read target][
		print "unable to find the file to patch!!"
		exit
	]
	either parse buffer [
		thru "int fcgi_accept_request("
		to "if (req->fd >= 0) {"
		pos: to end
	][
		insert pos "^/^-^-^-^-break;^/^-^-^-^-"
		write target buffer
		print "patch applied."
	][
		print "failed to locate the line to patch!!"
	]
]

patch-php
;---- end of code ----
6) Once the patch is applied :
	> ./configure --enable-fastcgi
	> make
	> sudo make install
7) Check if everything is ok :
	> php-cgi -h
	...
	you should see a -b option listed meaning you got proper
	FastCGI support.
	
	If it fails (occured on OSX), try with a full path instead :
	
	> /usr/local/bin/php-cgi -h
8) Edit Cheyenne's config file (httpd.cfg) to set the correct option in the PHP section. Non-Windows users have to also set the new 'delay option.
9) Test if all works well with : http://localhost/test.php

© Nenad Rakocevic - Softinnov