php不支持thttpd的最新版本thttpd-2.25b,所以我做了个2.25b的补丁
以php5.4为例
下载thttpd-2.25b.tar.gz
tar -zxf thttpd-2.25b.tar.gz
下载php-5.4.7.tar.bz2
tar -jxf php-5.4.7.tar.bz2
cd php-5.4.7
patch -p1 ../php-5.4.7_thttpd-2.25b.patch
./configure --prefix=/opt/php-5.4.7 --with-thttpd=../thttpd-2.25b
make&&make install
cd ../thttpd-2.25b
patch -p1 <../thttpd-2.25b-fix_getline.patch
./configure --prefix=/usr/local
make&&make install
cp contrib/redhat-rpm/thttpd.conf /etc/
cp contrib/redhat-rpm/thttpd.init /etc/init.d/thttpd
安装后的thttpd已经内含了php的解释器
thttpd.conf修改如下
cat /etc/thttpd.conf
# This section overrides defaults
dir=/usr/local/www
chroot
user=www# default = nobody
logfile=/var/log/thttpd.log
#pidfile=/var/run/thttpd.pid
# This section _documents_ defaults in effect
# port=80
# nosymlink# default = !chroot
# novhost
# nocgipat
# nothrottles
# host=0.0.0.0
# charset=iso-8859-1
/etc/init.d/thttpd start
server api已经是thttpd
php5.3的编译方法相同