LAMP源代码编译整理
生活随笔
收集整理的這篇文章主要介紹了
LAMP源代码编译整理
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
?在我們編譯安裝Apache 之前,要考慮的是讓Apache 在什么樣的模式下運(yùn)行,因?yàn)閺腁pache 2.0
就加入了MPM(Multi-Processing Modules,多道處理模塊)。 Apache 2.0 在性能上的改善最吸引人。在支持POSIX 線程的Unix 系統(tǒng)上,Apache 可以通過(guò)不 同的MPM 運(yùn)行在一種多進(jìn)程與多線程相混合的模式下,增強(qiáng)部分配置的可擴(kuò)充性能。相比于Apache 1.3,2.0 版本做了大量的優(yōu)化來(lái)提升處理能力和可伸縮性,并且大多數(shù)改進(jìn)在默認(rèn)狀態(tài)下即可生效。 但是在編譯和運(yùn)行時(shí)刻,2.0 也有許多可以顯著提高性能的選擇. 毫不夸張地說(shuō),MPM 的引入是Apache 2.0 最重要的變化。大家知道,Apache 是基于模塊化的設(shè) 計(jì),而Apache 2.0 更擴(kuò)展了模塊化設(shè)計(jì)到Web 服務(wù)器的最基本功能。服務(wù)器裝載了一種多道處理模 塊,負(fù)責(zé)綁定本機(jī)網(wǎng)絡(luò)端口、接受請(qǐng)求,并調(diào)度子進(jìn)程來(lái)處理請(qǐng)求。擴(kuò)展模塊化設(shè)計(jì)有兩個(gè)重要好 處: ◆ Apache 可以更簡(jiǎn)潔、有效地支持多種操作系統(tǒng); ◆ 服務(wù)器可以按站點(diǎn)的特殊需要進(jìn)行自定制。 在用戶級(jí),MPM 看起來(lái)和其它Apache 模塊非常類似。主要區(qū)別是在任意時(shí)刻只能有一種MPM 被 裝載到服務(wù)器中。prefork 的工作原理及配置 如果不用“--with-mpm”顯式指定某種MPM,prefork 就是Unix 平臺(tái)上缺省的MPM。它所采用 的預(yù)派生子進(jìn)程方式也是Apache 1.3 中采用的模式。prefork 本身并沒(méi)有使用到線程,2.0 版使用 它是為了與1.3 版保持兼容性;另一方面,prefork 用單獨(dú)的子進(jìn)程來(lái)處理不同的請(qǐng)求,進(jìn)程之間 是彼此獨(dú)立的,這也使其成為最穩(wěn)定的MPM 之一。
若使用prefork,在make 編譯和make install 安裝后,使用“httpd -l”來(lái)確定當(dāng)前使用的 MPM,應(yīng)該會(huì)看到prefork.c(如果看到worker.c 說(shuō)明使用的是worker MPM,依此類推)。再查看 缺省生成的httpd.conf 配置文件,里面包含如下配置段:<IfModule prefork.c> StartServers 5 MinSpareServers 5 MaxSpareServers 10 MaxClients 150 MaxRequestsPerChild 0 </IfModule>
prefork 的工作原理是,控制進(jìn)程在最初建立“StartServers”個(gè)子進(jìn)程后,為了滿足 MinSpareServers 設(shè)置的需要?jiǎng)?chuàng)建一個(gè)進(jìn)程,等待一秒鐘,繼續(xù)創(chuàng)建兩個(gè),再等待一秒鐘,繼續(xù)創(chuàng) 建四個(gè)……如此按指數(shù)級(jí)增加創(chuàng)建的進(jìn)程數(shù),最多達(dá)到每秒32 個(gè),直到滿足MinSpareServers 設(shè) 置的值為止。這就是預(yù)派生(prefork)的由來(lái)。這種模式可以不必在請(qǐng)求到來(lái)時(shí)再產(chǎn)生新的進(jìn)程。 從而減小了系統(tǒng)開(kāi)銷以增加性能。 MaxSpareServers 設(shè)置了最大的空閑進(jìn)程數(shù),如果空閑進(jìn)程數(shù)大于這個(gè)值,Apache 會(huì)自動(dòng) kill 掉一些多余進(jìn)程。這個(gè)值不要設(shè)得過(guò)大,但如果設(shè)的值比MinSpareServers 小,Apache 會(huì)自 動(dòng)把其調(diào)整為MinSpareServers+1。如果站點(diǎn)負(fù)載較大,可考慮同時(shí)加大MinSpareServers 和 MaxSpareServers。 MaxRequestsPerChild 設(shè)置的是每個(gè)子進(jìn)程可處理的請(qǐng)求數(shù)。每個(gè)子進(jìn)程在處理了 “MaxRequestsPerChild”個(gè)請(qǐng)求后將自動(dòng)銷毀。0 意味著無(wú)限,即子進(jìn)程永不銷毀。雖然缺省設(shè) 為0 可以使每個(gè)子進(jìn)程處理更多的請(qǐng)求,但如果設(shè)成非零值也有兩點(diǎn)重要的好處: ◆ 可防止意外的內(nèi)存泄漏; ◆ 在服務(wù)器負(fù)載下降的時(shí)侯會(huì)自動(dòng)減少子進(jìn)程數(shù)。 因此,可根據(jù)服務(wù)器的負(fù)載來(lái)調(diào)整這個(gè)值。筆者認(rèn)為10000 左右比較合適。 MaxClients 是這些指令中最為重要的一個(gè),設(shè)定的是Apache 可以同時(shí)處理的請(qǐng)求,是對(duì) Apache 性能影響最大的參數(shù)。其缺省值150 是遠(yuǎn)遠(yuǎn)不夠的,如果請(qǐng)求總數(shù)已達(dá)到這個(gè)值(可通過(guò) ps -ef|grep http|wc -l 來(lái)確認(rèn)),那么后面的請(qǐng)求就要排隊(duì),直到某個(gè)已處理請(qǐng)求完畢。這就是 系統(tǒng)資源還剩下很多而HTTP 訪問(wèn)卻很慢的主要原因。系統(tǒng)管理員可以根據(jù)硬件配置和負(fù)載情況來(lái) 動(dòng)態(tài)調(diào)整這個(gè)值。雖然理論上這個(gè)值越大,可以處理的請(qǐng)求就越多,但Apache 默認(rèn)的限制不能大于 256。如果把這個(gè)值設(shè)為大于256,那么Apache 將無(wú)法起動(dòng)。事實(shí)上,256 對(duì)于負(fù)載稍重的站點(diǎn)也 是不夠的。在Apache 1.3 中,這是個(gè)硬限制。如果要加大這個(gè)值,必須在“configure”前手工修 改的源代碼樹(shù)下的src/include/httpd.h 中查找256,就會(huì)發(fā)現(xiàn)“#define HARD_SERVER_LIMIT 256” 這行。把256 改為要增大的值(如4000),然后重新編譯Apache 即可。在Apache 2.0 中新加入了 ServerLimit 指令,使得無(wú)須重編譯Apache 就可以加大MaxClients。下面是筆者的prefork 配置段: <IfModule prefork.c> StartServers 10 MinSpareServers 10 MaxSpareServers 15 ServerLimit 2000 MaxClients 1000 MaxRequestsPerChild 10000 </IfModule>
上述配置中,ServerLimit 的最大值是20000,對(duì)于大多數(shù)站點(diǎn)已經(jīng)足夠。如果一定要再加 大這個(gè)數(shù)值,對(duì)位于源代碼樹(shù)下server/mpm/prefork/prefork.c 中以下兩行做相應(yīng)修改即可: #define DEFAULT_SERVER_LIMIT 256#define MAX_SERVER_LIMIT 20000
worker的工作原理及配置 相對(duì)于prefork,worker 是2.0 版中全新的支持多線程和多進(jìn)程混合模型的MPM。由于使 用線程來(lái)處理,所以可以處理相對(duì)海量的請(qǐng)求,而系統(tǒng)資源的開(kāi)銷要小于基于進(jìn)程的服務(wù)器。但是, worker 也使用了多進(jìn)程,每個(gè)進(jìn)程又生成多個(gè)線程,以獲得基于進(jìn)程服務(wù)器的穩(wěn)定性。這種MPM 的 工作方式將是Apache 2.0 的發(fā)展趨勢(shì)。 在configure -with-mpm=worker 后,進(jìn)行make 編譯、make install 安裝。在缺省生成的 httpd.conf 中有以下配置段:<IfModule worker.c> StartServers 2 MaxClients 150 MinSpareThreads 25 MaxSpareThreads 75 ThreadsPerChild 25 MaxRequestsPerChild 0 </IfModule>
worker 的工作原理是,由主控制進(jìn)程生成“StartServers”個(gè)子進(jìn)程,每個(gè)子進(jìn)程中包含 固定的ThreadsPerChild 線程數(shù),各個(gè)線程獨(dú)立地處理請(qǐng)求。同樣,為了不在請(qǐng)求到來(lái)時(shí)再生成線 程,MinSpareThreads 和MaxSpareThreads 設(shè)置了最少和最多的空閑線程數(shù);而MaxClients 設(shè)置了 所有子進(jìn)程中的線程總數(shù)。如果現(xiàn)有子進(jìn)程中的線程總數(shù)不能滿足負(fù)載,控制進(jìn)程將派生新的子進(jìn) 程。 MinSpareThreads 和MaxSpareThreads 的最大缺省值分別是75 和250。這兩個(gè)參數(shù)對(duì)Apache 的性能影響并不大,可以按照實(shí)際情況相應(yīng)調(diào)節(jié)。
ThreadsPerChild 是worker MPM 中與性能相關(guān)最密切的指令。ThreadsPerChild 的最大缺 省值是64,如果負(fù)載較大,64 也是不夠的。這時(shí)要顯式使用ThreadLimit 指令,它的最大缺省值 是20000 。上述兩個(gè)值位于源碼樹(shù)server/mpm/worker/worker.c 中的以下兩行: #define DEFAULT_THREAD_LIMIT 64
#define MAX_THREAD_LIMIT 20000 這兩行對(duì)應(yīng)著ThreadsPerChild 和ThreadLimit 的限制數(shù)。最好在configure 之前就把64 改成所希望的值。注意,不要把這兩個(gè)值設(shè)得太高,超過(guò)系統(tǒng)的處理能力,從而因Apache 不起動(dòng)使 系統(tǒng)很不穩(wěn)定。 Worker 模式下所能同時(shí)處理的請(qǐng)求總數(shù)是由子進(jìn)程總數(shù)乘以ThreadsPerChild 值決定的, 應(yīng)該大于等于MaxClients。如果負(fù)載很大,現(xiàn)有的子進(jìn)程數(shù)不能滿足時(shí),控制進(jìn)程會(huì)派生新的子 進(jìn)程。默認(rèn)最大的子進(jìn)程總數(shù)是16,加大時(shí)也需要顯式聲明ServerLimit(最大值是20000)。這 兩個(gè)值位于源碼樹(shù)server/mpm/worker/worker.c 中的以下兩行:#define DEFAULT_SERVER_LIMIT 16
#define MAX_SERVER_LIMIT 20000 需要注意的是,如果顯式聲明了ServerLimit,那么它乘以ThreadsPerChild 的值必須大 于等于MaxClients,而且MaxClients 必須是ThreadsPerChild 的整數(shù)倍,否則Apache 將會(huì)自動(dòng)調(diào) 節(jié)到一個(gè)相應(yīng)值(可能是個(gè)非期望值)。下面是筆者的worker 配置段:<IfModule worker.c> StartServers 3 MaxClients 2000 ServerLimit 25 MinSpareThreads 50 MaxSpareThreads 200 ThreadLimit 200 ThreadsPerChild 100 MaxRequestsPerChild 0 </IfModule>
通過(guò)上面的敘述,可以了解到Apache 2.0 中prefork 和worker 這兩個(gè)重要MPM 的工作原 理,并可根據(jù)實(shí)際情況來(lái)配置Apache 相關(guān)的核心參數(shù),以獲得最大的性能和穩(wěn)定性。
源碼安裝LAMP
源代碼編譯都是使用C語(yǔ)言編寫的,需要在本機(jī)編譯才能安裝。 檢查gcc,可用命令gcc -v
可以卸載默認(rèn)的低版本的環(huán)境
rpm -qa | grep -i httpd rpm -e httpXXXX yum remove
rpm -qa | grep -i mysql
rpm -qa | grep -i php
安裝libxml2 庫(kù)文件 libxml2 是個(gè)xml的c語(yǔ)言版的解析器。
# tar xf libxml2-2.6.30.tar.gz? # cd libxml2-2.6.30
# ./configure --prefix=/usr/local/libxml2 && make && make install
安裝libmcrypt庫(kù) libmcrypt 加密解密庫(kù) # tar xf libmcrypt-2.5.8.tar.gz # ./configure ?--prefix=/usr/local/libmcrypt && make && make install
安裝zlib庫(kù)
zlib是提供數(shù)據(jù)壓縮用的函式庫(kù)
# tar xf zlib-1.2.3.tar.bz2? # ./configure --prefix=/usr/local/zlib && make && make install
安裝libpng 庫(kù) png圖片處理 ./configure --prefix=/usr/local/libpng && make && make install
安裝jpeg6庫(kù) 安裝GD2庫(kù)前所需的jpeg6庫(kù),需要手動(dòng)創(chuàng)建目錄
# mkdir -p /usr/local/jpeg6/bin # mkdir -p /usr/local/jpeg6/lib # mkdir -p /usr/local/jpeg6/include # mkdir -p /usr/local/jpeg6/man/man1
# ./configure \ > --prefix=/usr/local/jpeg6 \ > --enable-shared \ ? ? ? ? ? ? ? ?#建立共享庫(kù)使用的GNU的libtool > --enable-static ? #建立靜態(tài)庫(kù)使用的GNU的libtool
# make && make install
安裝freetype ? 字體庫(kù)
# ./configure --prefix=/usr/local/freetype && make && make install
安裝autoconf 庫(kù) Autoconf是一個(gè)用于生成可以自動(dòng)地配置軟件源代碼包以適應(yīng)多種Unix類系統(tǒng)的 shell腳本的工具。
# tar xf autoconf-2.63.tar.gz # ./configure && make && make install
安裝GD庫(kù) php處理圖形的擴(kuò)展庫(kù),GD庫(kù)提供了一系列用來(lái)處理圖片的API,使用GD庫(kù)可以處理圖片,或者生成圖片
# tar xf gd-2.0.33.tar.gz # ./configure --prefix=/usr/local/gd2 --with-zlib=/usr/local/zlib/ --with-jpeg=/usr/local/jpeg6/ --with-png=/usr/local/libpng/ --with-freetype=/usr/local/freetype/
會(huì)看到 ** Configuration summary for gd 2.0.33:
? ?Support for PNG library: ? ? ? ? ?yes ? ?Support for JPEG library: ? ? ? ? yes ? ?Support for Freetype 2.x library: yes ? ?Support for Fontconfig library: ? yes ? ?Support for Xpm library: ? ? ? ? ?yes ? ?Support for pthreads: ? ? ? ? ? ? yes
? ?make && make install
安裝apache2 服務(wù)器 為了試驗(yàn)采用worker模式
# tar xf httpd-2.2.17.tar.gz?
# ./configure --prefix=/usr/local/apache2work \ > --with-mpm=worker \ #指定worker模式 > --with-z=/usr/local/zlib/ \ #指定zlib庫(kù)的位置 > --with-include-apr \ #使用捆綁apr > --disable-userdir \ #請(qǐng)求映射到用戶特點(diǎn)目錄 > --sysconfdir=/etc/apache2 \ #配置文件位置 > --enable-so \ #以動(dòng)態(tài)共享對(duì)象編譯 > --enable-deflate=shared #縮小傳輸碼 > --enable-expires=shared #期滿頭控制 > --enable-rewrite=shated #基于規(guī)則的URL > --enable-static-suport #建立一個(gè)靜態(tài)鏈接版本
make $$ make install
# cp apachectl /etc/init.d/apache # chmod +x /etc/init.d/apache? # /etc/init.d/apache start # netstat -anpt | grep 80 tcp ? ? ? ?0 ? ? ?0 0.0.0.0:80 ? ? ? ? ? ? ? ? ?0.0.0.0:* ? ? ? ? ? ? ? ? ? LISTEN ? ? ?13116/httpd
可以看到五個(gè)進(jìn)程。 ps -ef | grep httpd root ? ? 13116 ? ? 1 ?0 14:38 ? ? ? ? ?00:00:00 /usr/local/apache2work/bin/httpd -k start daemon ? 13117 13116 ?0 14:38 ? ? ? ? ?00:00:00 /usr/local/apache2work/bin/httpd -k start daemon ? 13118 13116 ?0 14:38 ? ? ? ? ?00:00:00 /usr/local/apache2work/bin/httpd -k start daemon ? 13120 13116 ?0 14:38 ? ? ? ? ?00:00:00 /usr/local/apache2work/bin/httpd -k start daemon ? 13121 13116 ?0 14:38 ? ? ? ? ?00:00:00 /usr/local/apache2work/bin/httpd -k start root ? ? 13221 15015 ?0 14:39 pts/1 ? ?00:00:00 grep httpd
觀察上面進(jìn)程列表,發(fā)現(xiàn) 進(jìn)程 13116 的父進(jìn)程 pid 是1,同時(shí)它也是 進(jìn)程的父進(jìn)程。 為什么是5個(gè)進(jìn)程呢?5個(gè)進(jìn)程之間有什么關(guān)系呢? mpm_default.h 中設(shè)置了默認(rèn)進(jìn)程數(shù)(DEFAULT_START_DAEMON),最大進(jìn)程數(shù)(DEFAULT_MAX_FREE_DAEMON),最小進(jìn)程數(shù)(DEFAULT_MIN_FREE_DAEMON)。在沒(méi)有參數(shù)配置的情況下,會(huì)應(yīng)用這些值。在 2.2.17 的版本中, DEFAULT_START_DAEMON 的值是 3。所以,上面的5個(gè)進(jìn)程的組成是:一個(gè)listen 進(jìn)程,3個(gè) recv進(jìn)程.還有一個(gè)進(jìn)程,我就不知道啦。
修改配置文件 http.conf,加入以下內(nèi)容,設(shè)置主線程為1: ? # worker MPM # StartServers: initial number of server processes to start # MaxClients: maximum number of simultaneous client connections # MinSpareThreads: minimum number of worker threads which are kept spare # MaxSpareThreads: maximum number of worker threads which are kept spare # ThreadsPerChild: constant number of worker threads in each server process # MaxRequestsPerChild: maximum number of requests a server process serves <IfModule mpm_worker_module> ? ? StartServers ? ? ? ? ?1 ? ? MaxClients ? ? ? ? ? 15 ? ? MinSpareThreads ? ? ? 1 ? ? MaxSpareThreads ? ? ? 1? ? ? ThreadsPerChild ? ? ? 1 ? ? MaxRequestsPerChild ? 0 </IfModule> ?查看進(jìn)程 $ /usr/local/apache2worker/bin/apachectl restart $ ps -ef |grep httpd fancp ? ?15242 ? ? 1 ?0 23:19 ? ? ? ? ?00:00:00 /usr/local/apache2worker/bin/httpd -k start fancp ? ?16035 15242 ?0 23:45 ? ? ? ? ?00:00:00 /usr/local/apache2worker/bin/httpd -k start fancp ? ?16036 15242 ?0 23:45 ? ? ? ? ?00:00:00 /usr/local/apache2worker/bin/httpd -k start fancp ? ?16041 ?4762 ?0 23:45 pts/1 ? ?00:00:00 grep httpd
安裝MYSQL
# useradd mysql
# tar xf mysql-5.1.55.tar.gz
./configure --prefix=/usr/local/mysql \ --localstatedir=/data/mysql --enable-assembler \ --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static \ --with-pthread --enable-static --with-big-tables --without-ndb-debug \ --with-charset=utf8 --with-extra-charsets=all \ --without-debug --enable-thread-safe-client --enable-local-infile --with-plugins=max
--localstatedir=/data/mysql //庫(kù)文件存放目錄 --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static//靜態(tài)編譯安裝mysql 客戶端和服務(wù)端 --with-pthread //采用線程 --with-big-tables //對(duì)大表的支持 --with-charset=utf8 //默認(rèn)字符集為utf8 --with-extra-charsets=all //安裝所有字符集 --without-debug //去掉debug 模式 --enable-thread-safe-client //以線程方式編譯客戶端 --with-plugins=max //添加對(duì)innodb 及partition 的支持 --enable-local-infile //對(duì)load data 的支持
make && make install
初始化數(shù)據(jù)庫(kù) cd /usr/local/mysql/ mysql]# bin/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/data/mysql/ --user=mysql
相應(yīng)權(quán)限的修改 # chown -R root:mysql /usr/local/mysql/ # chown -R mysql:mysql /data/mysql/
配置文件 cp support-file/my-medium.cnf /etc/my.cnf cp support-files/mysql/mysql.server /etc/init.d/mysqld chmod 755 /etc/init.d/mysqld chkconfig --add mysqld
# vim /root/.bash_profile PATH=$PATH:$HOME/bin:/usr/local/mysql/bin # source /root/.bash_profile
啟動(dòng)數(shù)據(jù)庫(kù)并初始化密碼。 # service mysqld start Starting MySQL [ OK ] # mysqladmin -u root password xxxx //設(shè)置成自己的密碼
安裝PHP # tar xf php-5.2.9.tar.gz php-5.2.9 ?./configure \ > --prefix=/usr/local/php \ > --with-config-file-path=/usr/local/php/etc \ //php5配置文件 > --with-apxs2=/usr/local/apache2work/bin/apxs \ //apahce2位置 > --with-mysql=/usr/local/mysql/ \ //mysql位置 > --with-libxml-dir=/usr/local/libxml2/? > --with-png-dir=/usr/local/libpng/ \ > --with-jpeg-dir=/usr/local/jpeg6/ \ > --with-freetype-dir=/usr/local/freetype/ \ > --with-gd=/usr/local/gd2/ \ > --with-zlib-dir=/usr/local/zlib/ \ > --with-mcrypt=/usr/local/libmcrypt/ \ > --with-mysqli=/usr/local/mysql/bin/mysql_config \ //激活mysqli的功能 > --enable-soap \ //變量激活SOAP和WEB servers > --enable-mbstring=all \ //多字節(jié)穿支持 > --enable-sockets //變量激活socket通信
+--------------------------------------------------------------------+ | License: ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | | This software is subject to the PHP License, available in this ? ? | | distribution in the file LICENSE. ?By continuing this installation | | process, you are bound by the terms of this license agreement. ? ? | | If you do not agree with the terms of this license, you must abort | | the installation process at this point. ? ? ? ? ? ? ? ? ? ? ? ? ? ?| +--------------------------------------------------------------------+
Thank you for using PHP.
make && make install
報(bào)錯(cuò) /usr/bin/ld: cannot find -lltdl collect2: ld returned 1 exit status make: *** [libphp5.la] Error 1
解決方案;安裝libtool-ltdl-devel 安裝完成后可使用 make test 測(cè)試
配置文件 # cp php.ini-dist /usr/local/php/etc/php.ini
與apache整合 在編譯時(shí)我們使用了--with-apxs2=/usr/local/apache2work/bin/apxs ,將php作為apache功能模塊使用 但是還需要修該配置文件,添加支持php解析。使用vi 編譯http.conf 在AddTyep application/x-gzip .gz .tgz下添加 AddType application/x-httpd-php .php .phtml
? # If the AddEncoding directives above are commented-out, then you ? ? # probably should define those extensions to indicate media types: ? ? # ? ? AddType application/x-compress .Z ? ? AddType application/x-gzip .gz .tgz ? ? AddType application/x-httpd-php .php .phtml 找到: <IfModule dir_module> DirectoryIndex index.html </IfModule> 將該行改為 <IfModule dir_module> DirectoryIndex index.html index.htm index.php </IfModule> 找到: #Include conf/extra/httpd-mpm.conf #Include conf/extra/httpd-info.conf #Include conf/extra/httpd-vhosts.conf #Include conf/extra/httpd-default.conf 去掉前面的“#”號(hào),取消注釋。 注意:以上 4 個(gè)擴(kuò)展配置文件中的設(shè)置請(qǐng)按照相關(guān)原則進(jìn)行合理配置!
在htdocs下創(chuàng)建test.php <?php phpinfo(); ?> 重啟apache測(cè)試
安裝zend 加速器 為了提高php速度,理論上zend加速器可以提高40%-100%的速度。 tar xf ZendOptimizer-3.3.0a-linux-glibc21.i386 ./install.sh
會(huì)出現(xiàn)圖形界面 安裝提示:輸入Zend安裝的位置 /usr/local/zend 詢問(wèn)php.ini的所在位置 /usr/local/php/etc 詢問(wèn)是否安裝apache及其啟動(dòng)文件位置 /usr/local/apache2work/bin/apachectl 詢問(wèn)是否重啟apache服務(wù)
最后在test.php頁(yè)面上可以看到Zend的信息
安裝phpMyAdmin phpmyadmin是使用php語(yǔ)言開(kāi)發(fā)的一個(gè)mysql管理軟件,通過(guò)web形式管理mysql。
# tar xf phpMyAdmin-3.2.0-all-languages.tar.bz2? # mv phpMyAdmin-3.2.0-all-languages /usr/local/apache2work/htdocs/phpmyadmin
在使用前。需要配置下創(chuàng)建config.inc.php,可以復(fù)制模板config.sample.inc.php # cp config.sample.inc.php config.inc.php
配置phpmyadmin 通過(guò)身份驗(yàn)證模式,可以有2種方案。一種是http和cookie身份驗(yàn)證模式。 這種做法的好處是,登錄時(shí)在對(duì)話框中提示輸入密碼。mysql數(shù)據(jù)庫(kù)密碼沒(méi)有出現(xiàn)在 config.inc.php文件里,而且可以支持多用戶管理。 第二種方案是:config驗(yàn)證模式。密碼以明文寫在配置文件中。不會(huì)提示輸入密碼。
HTTP驗(yàn)證模式 vi config.inc.php
$i++; /* Authentication type */ $cfg['Servers'][$i]['auth_type'] = 'http'; //把cookie換成http /* Server parameters */ $cfg['Servers'][$i]['host'] = 'localhost'; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][$i]['compress'] = false; /* Select mysqli if your server has it */ $cfg['Servers'][$i]['extension'] = 'mysql'
保存退出后,進(jìn)去IP/phpmyadmin即可
COOKIE模式 vi config.inc.php
$i++; /* Authentication type */ $cfg['Servers'][$i]['auth_type'] = 'cookie'; //cookie模式 /* Server parameters */ $cfg['Servers'][$i]['host'] = 'localhost'; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][$i]['compress'] = false; /* Select mysqli if your server has it */ $cfg['Servers'][$i]['extension'] = 'mysql'
這樣啟動(dòng)phpmyadmin還是需要輸入密碼用戶名
如果需要cookie模式 在配置文件中加入
$cfg['Servers'][$i]['auth_type'] = 'cookie'; /* Server parameters */ $cfg['Servers'][$i]['host'] = 'localhost'; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][$i]['compress'] = false; /* Select mysqli if your server has it */ $cfg['Servers'][$i]['extension'] = 'mysql';
//加入這兩行 $cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]['password'] = 'zhang';
轉(zhuǎn)載于:https://blog.51cto.com/zcnick/773479
總結(jié)
以上是生活随笔為你收集整理的LAMP源代码编译整理的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 梦到朋友怀孕生孩子是什么意思
- 下一篇: opencv 在debian6.0下安装