在LINUX下安裝APACHE+PHP+MYSQL+ZNED+EACCELERATOR

一、   硬件軟件環

IBM X3650服務器,至強CPU30*2  

內存 4GB

硬盤:146GB*3

系統環境:RedHat Linux AS4_U5

 

 

準備工

        
1、軟件下載
                            eaccelerator-0.9.5.2.tar.bz2
                            httpd-2.0.61.tar.gz
                            mysql-5.0.27.tar.gz
                            php-5.2.1.tar.gz
                            ZendOptimizer-3.3.0a-linux-glibc21-i386.tar.gz
                            gd-2.0.33.tar.tar
                           軟件下載以後,上傳到服務器,使用:tar –zxvf 文件名解壓縮所有的文件。

 

2、編譯MYSQL
                            編譯MYSQL選項:
          
shell>./configure --prefix=/home/www/mysql --enable-assembler --with-charset=gbk --with-extra-charsets=gbk
                                       shell>Make && make install
編譯完成安裝以後,需要對相應的MYSQL目錄設置權限:
shell>chown -R root:mysql /home/mysql
shell>chown -R mysql:mysql /home/mysql/var
shell>chgrp -R mysql /home/mysql
加入MYSQL用戶:
shell>pw group add mysql
shell>pw user add mysql -g mysql -s /sbin/nologin
設置配置文件並安裝默認數據庫
shell>cp support-files/my-medium.cnf /etc/my.cnf
shell> cd /home/www/mysql
shell> bin/mysql_install_db --user=mysql
                            啓動數據庫
                            shell> /home/www/mysql/bin/mysqld_safe --user=mysql &

 

3、編譯APACHE
                            編譯APACHE
shell>./configure --prefix=/home/www/apache --enable-so --enable-module=most --enable-shared=max
            shell>Make && make install
                            修改CONF目錄下的httpd.conf文件,設置主機頭和端口
                            shell>vi /home/www/apache/conf/httpd.conf
                            啓動APACHE服務
                            shell>/home/www/apache/bin/apachectl start

 

4、編譯PHP支持的GD庫
                            GD庫:shell>./configure --prefix=/usr/local/gd
                  shell>Make && make install

 

5、編譯PHP
                            編譯PHP命令:
shell>./configure --prefix=/home/www/php --with-mysql=/home/www/mysql --with-apxs2=/home/www/apache/bin/apxs --with-gd --enable-gd-native-ttf –enable-zip  --disable-ipv6 --with-jpeg-dir --with-zlib-dir
shell>Make && make install
設置PHP.INI文件
Shell>cp php.ini-dist /etc/php.ini
Shell>vi php.ini
設置php.ini裏的參數完成以後,在APACHE的httpd.conf文件里加入:
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php .phtml

 

6、編譯eaccelerator
                        Shell>export PHP_PREFIX="/home/www/php"
               Shell>$PHP_PREFIX/bin/phpize
               Shell>./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config
               Shell>make && make install
                        完成安裝後,eaccelerator.so模塊位於 /usr/lib/php/extensions目錄中
               更新動態鏈接庫地址:
                  Shell>echo "/usr/lib/php/extensions" > /etc/ld.so.conf
Shell>ldconfig
修改php.ini:
                   加入;
zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20020429/eaccelerator.so" 注:模塊的具體位置;
     eaccelerator.shm_size="16" 注:共享內存大小;
     eaccelerator.cache_dir="/home/eaccelerator" 注:緩存目錄;
     eaccelerator.enable="1"
     eaccelerator.optimizer="1"
     eaccelerator.check_mtime="1"
     eaccelerator.debug="0"
     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"
        緩存目錄我們在這裏指定的是 /home目錄上的 eaccelerator 目錄,如果沒      
        有,自己創建一個;權限是0777
            創建緩存目錄
        Shell>mkdir /tmp/eaccelerator
        Shell>chmod 0777 /tmp/eaccelerator

 

            注意:
              以上的配置是把 eaccelerator 做爲 Zend 的擴展模塊來編譯的辦法。如果您的PHP是用安裝模式編譯的,要把 zend_extension改爲zend_extension_ts

 

如果您是把 eaccelerator 做爲 PHP的一個擴展,要用下面的配置

 

 

extension="eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/home/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章