FreeBSD7安装Zeus+PHP5手记
FreeBSD/Linux/Server November 6th, 2008 738 Views最近做公司的新项目也在搭建和测试服务器架构环境,机器上装的FreeBSD 7.0-RELEASE (GENERIC)系统,项目是PHP开发的得在服务器配置PHP的运行环境Zeus的负载能力还不错就选它做Web Server,以前装过Zeus是在FreeBSD6上的PHP也是安装的4.4.8的版本这次在FreeBSD7和PHP5还没有装过就来试验一把,按着以前的安装步骤进行吧。
一、[PHP5的安装]
PHP的安装有很多种方式我这里就不费话多说了。这里我们采用源代码编译方式安装你也可以按自己的喜好选择安装方式。首先得下载最新的PHP5的源代码包进入htttp://www.php.net下载PHP5的最新源码包php-5.2.6.tar.gz。这里我要说明PHP提供强大的扩展有些扩展需要系统库的支持,本文讲解一些PHP一些常用的扩展的安装,如:gd、iconv、mbstring、xml、mcrypt、curl、gettext、mysql、mssql等,以下一一开始安装编译了:
1、gd库扩展:
gd库是PHP的一个图形处理扩展需要的支持库比较多:Zlib、libjpeg、libpng、freetype2等。
a)安装Zlib # cd /usr/ports/security/find-zlib/ # make install clean ===> Vulnerability check disabled, database not found ===> Extracting for find_zlib-1.9 ...... 注:执行make install clean命令后会自动从网络下载打包文件并进行编译、安装、清除编译所产生的文件。 Zlib类库安装完毕,非常的方便一条命令就可以搞定,其它类库的安装方法一样。 b)安装libjpeg # cd /usr/ports/graphics/jpeg # make install clean c)安装libpng # cd /usr/ports/graphics/png # make install clean d)安装freetype # cd /usr/ports/print/freetype2 # make install clean e)安装gd # cd /usr/ports/graphics/gd # make install clean
2、xml函数库安装
# cd /usr/ports/textproc/libxml2 # make install clean
3、mcrypt函数库安装
a)安装libmcrypt # cd /usr/ports/security/libmcrypt # make install clean b)安装libltdl # cd /usr/ports/devel/libltdl15 # make install clean c)安装mhash # cd /usr/ports/security/mhash # make install clean
4、curl函数库安装
# cd /usr/ports/ftp/curl # make install clean
5、mysql函数库安装
# cd /usr/ports/databases/mysql51-client # make install clean
6、mssql函数库安装
这里我们使用freetds提供php与mssql连接的支持,freetds同时还其它数据库,详细可上官方网站了解,http://www.freetds.org/
# fetch ftp://ftp.ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz # tar -zxvf freetds-stable.tgz # cd freetds-0.82 # ./configure --prefix=/usr/local/freetds --with-tdsver=8.0 --enable-msdblib --enable-dbmfix --with-gnu-ld --enable-shared --enable-static # make # make install
8、PHP(fastcgi)的编译安装
常用的扩展函数库我们已经安装完,现在开始进行PHP的编译安装,首先进行configure将我们安装的扩展就加入到参数中。
# tar -zxvf php-5.2.6.tar.gz # cd php-5.2.6 # ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql --with-mssql=/usr/local/freetds --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-debug --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-gettext --with-openssl --enable-sockets # make # make install # cp php.ini-dist /usr/local/php/etc/php.ini
二、[Zeus的安装]
Zeus就不用多介绍了,下载<Zeus Web Server v4.3r3 For FreeBSD5.x 特别版>带license.key的安装包,现在我们将在FreeBSD7上进行安装。
# tar -zxvf Zeus_43r3_FreeBSD5.tgz # cd Zeus_43r3_FreeBSD5 # ./zinstall You are installing a package built for FreeBSD5 WARNING: This package is built for a FreeBSD version 5 box (file extension "FreeBSD5"). This machines requires a package for an unknown system / architecture (file extension "UNKNOWN"). It is recommended that you download and install the correct binary. However, it is possible that you may be able to install this file. Do you want to continue installing this file? Y/N [N]: 注:以上是提醒安装包是FreeBSD5的,有可能在当前系统安装出错,是否继续安装,输入"Y"继续。 这时候会报如下错误: /usr/libexec/ld-elf.so.1: Shared object "libcrypt.so.2" not found, required by "miniperl" 因为我们是在FreeBSD7.0上进行安装,没有FreeBSD5上旧的库文件,可以使用ln命令建立一个链接解决此问题 # ln -s /lib/libcrypt.so.4 /usr/lib/libcrypt.so.2 在执行zinstall进行安装,顺利通过libcrypt.so.2找不到的问题,提示查看文档 Zeus Installation Program - Copyright (C) Zeus Technology 2006 Checking distribution ... all packages match checksums ...... 按CTRL+C 打入accept Where should the product be installed? [/usr/local/zeus]: (问你要安装到哪里默认 /usr/local/zeus) Installation options: 1. Full install of both admin server & web server 2. Stand-alone install of admin server 3. Clustered install of web serverH. Help Choose installation option [1]: (选择安装模式“1”全部安装) Enter the key filename, or leave blank for unlicensed mode: /usr/home/ly/license.key (输入密匙位置) Installing web-4.3r3... Installing snmp-4.3r3... Installing admin-4.3r3... Installing zperl-4.3r3... Installing webadmin-4.3r3... Installing webadmin_lang_en_gb-4.3r3... Installing webadmin_lang_en_us-4.3r3... Please choose a password for the admin server: ****** (输入管理员密码) Re-enter: ****** (重新输入密码) Enable SNMP support for web package? Y/N [N]: (默认不需要直接回车) Choose a UNIX user for the web process to run as [nobody]: (选择一个用户来运行Web进程,默认为[nobody]直接回车) Choose a UNIX group for the web process to run as [nobody]:(选择一个组来运行Web进程,默认为[nobody]直接回车) Zeus can be installed so that it automatically runs when this computer boots. Would you like Zeus to start at boot time? Y/N [Y]: (询问你是否系统启动时就运行Zeus) Start script copied to /usr/local/etc/rc.d/zeus.sh Installation successful, starting Zeus product software Initializing Zeus Application Framework. (C) 1995 - 2006 Zeus Technology Limited Zeus Admin Server - (C) 1995 - 2006 Zeus Technology Limited Version 4.3r3, Build date: Jun 16 2006 08:42:11 ...... Please read the release notes (/usr/local/zeus/webadmin/RELEASE_NOTES) 出现此提示Zeus已经安装完成,输入 http://ip:9090 安装成功的话就会跳出一个认证窗口,输入 admin 密码 就可以看到zeus的后台了。 接下来就是Zeus与PHP的整合,在Zeus以fastcgi方式执行PHP。
三、[Zeus的配置、PHP fast-cgi 支持]
Zeus的使用我以前有转载一些,这里就不在说明了,直接贴上地址:
Zeus中配置以FastCGI运行PHP http://blog.ly5.org/archives/105.html
Zeus Web Server和Php的整合 http://www.askwan.com/read.php?77
FreeBSD4.9+Zeus 4.2+MySQL+PHP安装指南 http://blog.ly5.org/archives/51.html
本文只以笔记形式记录整个安装过程与碰到问题的解决办法,如果安装过程有什么问题。如以上内容有问题的地方欢迎大家的指正、本着相互交流、学习研究,列出一些参考的相关资料:
http://bbs.woyool.com/viewthread.php
http://bbs.linuxpk.com/thread-10875-1-1.html
http://www.phpv.net/html/1586.html
http://blog.ly5.org/archives/52.html
http://www.sd001.net/html/2/2-2787.html

November 11th, 2008 at 18:01:43
为什么不用ports方式安装呢?