lizongbo at 618119.com 工作,生活,Android,前端,Linode,Ubuntu,nginx,java,apache,tomcat,Resin,mina,Hessian,XMPP,RPC

2010年11月2日

Ubuntu10.04上编译安装php5.3.3和wordpress3.0.1

Filed under: Linux,mysql,nginx — 标签:, , , , , — lizongbo @ 20:46

10.04上编译安装php5.3.3和wordpress3.0.1

1.先下载php5.3.3的源代码:
root@618119.com:/usr/local/app# wget http://cn2.php.net/get/php-5.3.3.tar.gz/from/am.php.net/mirror
来源:http://www.php.net/downloads.php

2.解压php的源代码:
root@618119.com:/usr/local/app# tar -zxvf -5.3.3.tar.gz

3.进入php源码目录:
准备编译:

./configure –prefix=/usr/local/app/php –enable-fastcgi –with-mysql=/usr/local/app/mysql –enable-zend-multibyte –with-config-file-path=/usr/local/app/php/conf –enable-discard-path –enable-force--redirect

提示:
configure: error: xml2-config not found. Please check your libxml2 installation

root@618119.com:/usr/local/app/php-5.3.3# sudo apt-get install libxml2-dev

4.make编译安装
root@618119.com:/usr/local/app/php-5.3.3# make
root@618119.com:/usr/local/app/php-5.3.3# make install

5.参考http://wiki.nginx.org/PHPFcgiExample 建立php-fcgi服务,
root@618119.com:/etc/init.d# vi php-fcgi
root@618119.com:/etc/init.d# chmod +x php-fcgi
root@618119.com:/etc/init.d# sudo /usr/sbin/update-rc.d -f php-fcgi defaults

php-fcgi的脚本如下:
root@618119.com:/usr/local/app/nginx/vhost/blog.618119.com# more /etc/init.d/php-fcgi
#!/bin/bash
BIND=127.0.0.1:9000
USER=root
PHP_FCGI_CHILDREN=15
PHP_FCGI_MAX_REQUESTS=1000

PHP_CGI=/usr/local/app/php/bin/php-cgi
PHP_CGI_NAME=`basename $PHP_CGI`
PHP_CGI_ARGS=”- USER=$USER PATH=/usr/local/app/php/bin PHP_FCGI_CHILDREN=$PHP_FC
GI_CHILDREN PHP_FCGI_MAX_REQUESTS=$PHP_FCGI_MAX_REQUESTS $PHP_CGI -b $BIND”
RETVAL=0

start() {
echo -n “Starting PHP FastCGI: ”
start-stop-daemon –quiet –start –background –chuid “$USER” –exec /usr
/bin/env — $PHP_CGI_ARGS
RETVAL=$?
echo “$PHP_CGI_NAME.”
}
stop() {
echo -n “Stopping PHP FastCGI: ”
killall -q -w -u $USER $PHP_CGI
RETVAL=$?
echo “$PHP_CGI_NAME.”
}

case “$1” in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo “Usage: php-fastcgi {start|stop|restart}”
exit 1
;;
esac
exit $RETVAL

配置blog域名的虚拟主机:
root@618119.com:/usr/local/app/nginx# mkdir vhost
root@618119.com:/usr/local/app/nginx# cd vhost/
root@618119.com:/usr/local/app/nginx/vhost# mkdir blog.618119.com
root@618119.com:/usr/local/app/nginx/vhost/blog.618119.com# cd blog.618119.com/

下载wordpress最新3.0.1版程序
root@618119.com:/usr/local/app/nginx/vhost/blog.618119.com# wget http://wordpress.org/latest.tar.gz
来源: http://wordpress.org/download/
root@618119.com:/usr/local/app/nginx/vhost/blog.618119.com# tar -zxvf latest.tar.gz
root@618119.com:/usr/local/app/nginx/vhost/blog.618119.com# cp -r .//* ./
root@618119.com:/usr/local/app/nginx/vhost/blog.618119.com# rm -rf wordpress/
下载wordpress的中文语言包:
root@618119.com:/usr/local/app/nginx/vhost/blog.618119.com# wget http://wpcn.googlecode.com/files/WordPress.v3.0.1.Simp.Chinese.Pack.Only.v1-wpcng.tar.gz
来源:http://code.google.com/p/wpcn/downloads/list
root@618119.com:/usr/local/app/nginx/vhost/blog.618119.com# tar -zxvf WordPress.v3.0.1.Simp.Chinese.Pack.Only.v1-wpcng.tar.gz
root@618119.com:/usr/local/app/nginx/vhost/blog.618119.com# cp -r ./wordpress/* ./
root@618119.com:/usr/local/app/nginx/vhost/blog.618119.com# rm -rf wordpress/

root@618119.com:/usr/local/app/nginx/vhost/blog.618119.com# vi ./wp-config.php

define (‘WPLANG’, ‘zh_CN’);

nginx.conf配置:

server {
server_name  blog.618119.com;
location / {
root   vhost/blog.618119.com;
index  index.html index.htm index.php;
}
}

参考:http://wiki.nginx.org/PHPFcgiExample

root@618119.com:/etc/init.d# service php-fcgi start

root@618119.com:/usr/local/app/nginx/conf# /usr/local/app/nginx/sbin/nginx -s reload

没有评论 »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress