更新與安裝 – Install Apache 2.2.11 or Upgrade on FreeBSD

Apache 2.2.11 主要是更新了個錯誤
步驟如下

1.更新 FreeBSD 的 src 與 ports 到目前最新版

cd /usr/src
make update

就個人經驗而言,最好是將相關的
apache-*, php5-* , pear-* , pecl-* , Smarty , eaccelerator , webmail 等都備份後移除
然後再一步一步安裝更新上去
這樣雖然很麻煩,卻最能避免產生問題後無法處理的情況
PS : 都安裝好了,沒有錯誤訊息, Apache 卻開不起來

2.先備份設定後,然後將相關套件及設定全數移除

pkg_info |sort > /root/pkg.info.txt
tar -zcvf /root/etc.tar.gz /etc
tar -zcvf /root/usr.local.etc.tar.gz /usr/local/etc
tar -zcvf /root/etc.namedb.tar.gz /var/named/etc/namedb
tar -zcvf /root/ports_options.tar.gz /var/db/ports
pkg_delete -f /var/db/pkg/apache*
pkg_delete -f /var/db/pkg/pecl*
pkg_delete -f /var/db/pkg/eaccelerator*
pkg_delete -f /var/db/pkg/smarty*
pkg_delete -f /var/db/pkg/joomla*
pkg_delete -f /var/db/pkg/eGroupware*
pkg_delete -f /var/db/pkg/pear*
pkg_delete -f /var/db/pkg/php5*

3.手動安裝更新 Apache 2.2.11_3

 
cd /usr/ports/www/apache22
make WITH_MPM=worker WITH_THREADS=yes WITH_STATIC_SUPPORT=yes WITH_APACHE_SUEXEC=yes WITH_ALL_STATIC_MODULES=yes WITHOUT_PROXY=yes WITH_AUTH_MODULES=yes WITH_DAV_MODULES=yes WITH_SSL_MODULES=yes
make install clean 
rehash
或是
cd /usr/ports/www/apache22
make config  
make install clean 
rehash

4.重新編譯 php-5.2.9

cd /usr/ports/lang/php5
make WITH_CLI=yes WITH_CGI=yes WITH_APACHE=yes WITH_MULTIBYTE=yes WITH_FASTCGI=yes WITH_PATHINFO=yes ;make install clean ; rehash
或是
cd /usr/ports/lang/php5
make config ; make install clean ;rehash
cd /usr/ports/lang/php5-extensions
make WITHOUT_X11=yes WITH_BZ2=yes WITH_CURL=yes WITH_FTP=yes WITH_GD=yes WITH_GETTEXT=yes WITH_MBSTRING=yes WITH_MYSQL=yes WITH_ZLIB=yes 
make install clean 
rehash
或是
cd /usr/ports/lang/php5-extensions
make config
make install clean
rehash
cd /usr/ports/databases/php5-mysqli
make install clean
rehash
cd /usr/ports/www/smarty
make install clean 
rehash
cd /usr/ports/www/eaccelerator
make install clean 
rehash
cd /usr/ports/security/pear-Auth_SASL
make install clean 
rehash

若 pear 無法安裝時,請先註解recode

ee /usr/local/etc/php/extensions.ini
;extension=recode.so
pear channel-update pear.php.net ( pear 更新 )
 
cd /usr/ports/deskutils/egroupware
make install clean
rehash

5. 修改 httpd.conf 設定

如果有在 make config 勾選 THREADS選項,就需要修改舊的 httpd.conf ,
因為之前的 載入模組( Load Module ) 改成新的模組內建 ( Built-in )

ee /usr/local/etc/apache22/httpd.conf
#Load Module xxxx

除了php5之外,全部的載入模組都用註解取消
如果沒有在 apache 的 make config 勾選 THREADS選項
則 httpd.conf 無需修改

6.修改php.ini

ee /usr/local/etc/php.ini
apache 未勾選 THREADS選項
extension_dir = “/usr/local/lib/php/20060613/”
apache 有勾選 THREADS選項
extension_dir = “/usr/local/lib/php/20060613-zts/”
ee /usr/local/etc/php/extensions.ini
;extension=recode.so

不註解的話, PHP 似乎無法正常運作( core dumped )

7. eaccelerator PHP 加速器設定

ee /usr/local/etc/php/extensions.ini
extension=bcmath.so
extension=bz2.so
extension=calendar.so
extension=ctype.so
extension=curl.so
extension=dom.so
extension=exif.so
extension=fileinfo.so
extension=filter.so
extension=ftp.so
extension=gd.so
extension=gettext.so
extension=gmp.so
extension=hash.so
extension=iconv.so
extension=imap.so
extension=json.so
extension=ldap.so
extension=mbstring.so
extension=mcrypt.so
extension=mhash.so
extension=ming.so
extension=mssql.so
extension=mysql.so
;extension=mysqli.so
extension=odbc.so
extension=openssl.so
extension=pcntl.so
extension=pcre.so
extension=pdf.so
extension=pdo.so
extension=pdo_sqlite.so
extension=pgsql.so
extension=posix.so
;extension=pspell.so
extension=radius.so
;extension=recode.so
extension=readline.so
extension=session.so
extension=simplexml.so
extension=snmp.so
extension=soap.so
extension=sockets.so
extension=spl.so
extension=sqlite.so
extension=tidy.so
extension=tokenizer.so
extension=wddx.so
extension=xml.so
extension=xmlreader.so
extension=xmlrpc.so
extension=xmlwriter.so
extension=xsl.so
extension=yaz.so
extension=zip.so
extension=zlib.so
;加入下列設定 
extension=eaccelerator.so
ee /usr/local/etc/php.ini
;加入下列設定
[eaccelerator]
zend_extension = “/usr/local/lib/php/20060613-zts/eaccelerator.so”
eaccelerator.shm_size = “128″
eaccelerator.cache_dir = “/tmp/eaccelerator”
eaccelerator.enable = “1″
eaccelerator.optimizer = “1″
eaccelerator.check_mtime = “1″
eaccelerator.debug = “0″
eaccelerator.log_file = “/var/log/httpd/eaccelerator.log”
eaccelerator.filter = “”
eaccelerator.shm_max = “0″
eaccelerator.shm_ttl = “0″
eaccelerator.shm_prune_period = “0″
eaccelerator.shm_only = “0″
eaccelerator.compress = “1″
eaccelerator.compress_level = “9″
eaccelerator.keys = “shm”
eaccelerator.sessions = “shm”
eaccelerator.content = “shm”

8.測試設定檔是否正確

/usr/local/sbin/apachectl configtest

9.重新起動 Apache

/usr/local/etc/rc.d/apache22 start

注意有無出現錯誤訊息
lynx http://localhost/
原文 http://gary1974tw.pixnet.net/blog/post/26613606

发表评论

电子邮件地址不会被公开。 必填项已用*标注