真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

centos5源碼安裝Nginx、mysql和php的方法-創(chuàng)新互聯(lián)

這篇文章主要講解了“centos5源碼安裝Nginx、mysql和php的方法”,文中的講解內(nèi)容簡(jiǎn)單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來(lái)研究和學(xué)習(xí)“centos5源碼安裝Nginx、mysql和php的方法”吧!

專(zhuān)注于為中小企業(yè)提供成都網(wǎng)站設(shè)計(jì)、做網(wǎng)站服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)貢覺(jué)免費(fèi)做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動(dòng)了上千企業(yè)的穩(wěn)健成長(zhǎng),幫助中小企業(yè)通過(guò)網(wǎng)站建設(shè)實(shí)現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。



我安裝的系統(tǒng):Centos5

1、下載;

我安裝的下載來(lái)自張宴博文下的地址,下載保存的是home下自己目錄的一個(gè)文件夾下:



代碼如下:


cd /home/xuxx/software
wget /tupian/20230522/nginx-0.7.51.tar.gz
wget /tupian/20230522/php-5.2.8.tar.gz
wget /tupian/20230522/php-5.2.8-fpm-0.5.10.diff.gz
wget /tupian/20230522/mysql-5.1.33.zip
wget /tupian/20230522/libiconv-1.13.tar.gz
wget /tupian/20230522/libmcrypt-2.5.8.tar.gz
wget /tupian/20230522/mcrypt-2.6.8.tar.gz
wget /tupian/20230522/memcache-2.2.5.tgz
wget /tupian/20230522/mhash-0.9.9.9.tar.gz
wget /tupian/20230522/pcre-7.8.tar.gz
wget /tupian/20230522/eaccelerator-0.9.5.3.tar.bz2
wget /tupian/20230522/PDO_MYSQL-1.0.2.tgz
wget /tupian/20230522/ImageMagick.tar.gz
wget /tupian/20230522/imagick-2.2.2.tgz



2、準(zhǔn)備編譯安裝環(huán)境,需要編譯源碼用到gc++
建議如果是新安裝的系統(tǒng),使用yum upgrade更新下系統(tǒng)。



代碼如下:


sudo -s
LANG=C
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel
glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel
openldap openldap-devel nss_ldap openldap-clients openldap-servers



注意:這里所有的命令是一行的而不能有換行符,如果是copy的時(shí)候,注意要去處該換行符

確保安裝成功!才能正確使用編譯。

3、安裝:

一、安裝PHP 5.2.8(FastCGI模式)
1、編譯安裝PHP 5.2.8所需的支持庫(kù):

1] libiconv庫(kù)



代碼如下:


tar zxvf libiconv-1.13.tar.gz
cd libiconv-1.13/
./configure --prefix=/usr/local
make
make install
make clean
>make distclean
cd ../



make clean 和make distclean都是刪除安裝過(guò)程中生成的緩存文件。當(dāng)然如果你不介意放著也可以跳過(guò)這兩步清理操作。

2]libmcrypt庫(kù)



代碼如下:


tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure
make
make install
make clean
make distclean
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
make
make install
make clean
make distclean
cd /tupian/20230522/



3] mhash庫(kù)



代碼如下:


tar zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9/
./configure
make
make install
cd ../



4]mcrypt庫(kù)

注意:因?yàn)樵搸?kù)和libmcrypt有依賴性,所以在安裝前必須知道libmcrypt,否則的話會(huì)出現(xiàn):
錯(cuò)誤



代碼如下:


checking for libmcrypt – version >= 2.5.0…
*** ‘libmcrypt-config –version’ returned 2.4.0, but LIBMCRYPT (2.5.8)
*** was found! If libmcrypt-config was correct, then it is best
*** to remove the old version of LIBMCRYPT. You may also be able to fix the error
*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing
*** /etc/ld.so.conf. Make sure you have run ldconfig if that is
*** required on your system.
*** If libmcrypt-config was wrong, set the environment variable LIBMCRYPT_CONFIG
*** to point to the correct copy of libmcrypt-config, and remove the file config.cache
*** before re-running configure
configure: error: *** libmcrypt was not found



是因?yàn)閜ath的問(wèn)題,所以執(zhí)行:



代碼如下:


ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config



然后再安裝:



代碼如下:


tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8/
/sbin/ldconfig
./configure
make
make install
cd ../



二、安裝mysql



代碼如下:


/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql xxx
unzip mysql-5.1.33.zip
cd mysql-5.1.33/
./configure --prefix=/usr/local/webserver/mysql/ --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables
--with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=innobase
make
make install
make clean
make distclean
chmod +w /usr/local/webserver/mysql
chown -R xxx:mysql /usr/local/webserver/mysql
cp support-files/my-medium.cnf.sh /usr/local/webserver/mysql/my.cnf
cd ../



注意:這里編譯./configure命令是一行的而不能有換行符,如果是copy的時(shí)候,注意要去處該換行符

在最后一步拷貝的時(shí)候,我安裝完在support-files下沒(méi)有my-medium.cnf而只有my-medium.cnf.sh所以將這個(gè)文件拷貝過(guò)去。

@張宴原文:

附:以下為附加步驟,如果你想在這臺(tái)服務(wù)器上運(yùn)行MySQL數(shù)據(jù)庫(kù),則執(zhí)行以下兩步。如果你只是希望讓PHP支持MySQL擴(kuò)展庫(kù),能夠連接其他服務(wù)器上的MySQL數(shù)據(jù)庫(kù),那么,以下兩步無(wú)需執(zhí)行。
①、以xxx用戶帳號(hào)的身份建立數(shù)據(jù)表:



代碼如下:


/usr/local/webserver/mysql/bin/mysql_install_db --basedir=/usr/local/webserver/mysql --datadir=/usr/local/webserver/mysql/data --user=xxx



②、啟動(dòng)MySQL(最后的&表示在后臺(tái)運(yùn)行)



代碼如下:


/bin/sh /usr/local/webserver/mysql/bin/mysqld_safe --defaults-file=/usr/local/webserver/mysql/my.cnf &



3、編譯安裝PHP(FastCGI模式)



代碼如下:


tar zxvf php-5.2.8.tar.gz
gzip -cd php-5.2.8-fpm-0.5.10.diff.gz | patch -d php-5.2.8 -p1
cd php-5.2.8/
./configure --prefix=/usr/local/webserver/php --with-config-file-path=/usr/local/webserver/php/etc --with-mysql=/usr/local/webserver/mysql
--with-mysqli=/usr/local/webserver/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib
--with-libxml-dir=/usr --enable-xml --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-fpm --enable-force-cgi-redirect
--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap
--with-ldap-sasl
make ZEND_EXTRA_LIBS='-liconv'
make install
cp php.ini-dist /usr/local/webserver/php/etc/php.ini
cd ../



注意:這里./configure命令是一行的而不能有換行符,如果是copy的時(shí)候,注意要去處該換行符

4、編譯安裝PHP5擴(kuò)展模塊--可選安裝



代碼如下:


tar zxvf memcache-2.2.5.tgz
cd memcache-2.2.5/
/usr/local/webserver/php/bin/phpize
./configure --with-php-config=/usr/local/webserver/php/bin/php-config
make
make install
make clean
make distclean
cd ../
tar jxvf eaccelerator-0.9.5.3.tar.bz2
cd eaccelerator-0.9.5.3/
/usr/local/webserver/php/bin/phpize
./configure --enable-eaccelerator=shared --with-php-config=/usr/local/webserver/php/bin/php-config
make
make install
make clean
make distclean
cd ../
tar zxvf PDO_MYSQL-1.0.2.tgz
cd PDO_MYSQL-1.0.2/
/usr/local/webserver/php/bin/phpize
./configure --with-php-config=/usr/local/webserver/php/bin/php-config --with-pdo-mysql=/usr/local/webserver/mysql
make
make install
make clean
make distclean
cd ../
tar zxvf ImageMagick.tar.gz
cd ImageMagick-6.5.1-2/
./configure
make
make install
make clean
make distclean
cd ../
tar zxvf imagick-2.2.2.tgz
cd imagick-2.2.2/
/usr/local/webserver/php/bin/phpize
./configure --with-php-config=/usr/local/webserver/php/bin/php-config
make
make install
make clean
make distclean
cd ../




5、修改php.ini文件
手工修改:查找/usr/local/webserver/php/etc/php.ini中的extension_dir = "./"
修改為extension_dir = "/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613/"
并在此行后增加以下幾行,然后保存:
extension = "memcache.so"
extension = "pdo_mysql.so"
extension = "imagick.so"

再查找output_buffering = Off
修改為output_buffering = On

6、配置eAccelerator加速PHP:
mkdir -p /usr/local/webserver/eaccelerator_cache
vi /usr/local/webserver/php/etc/php.ini
按shift+g鍵跳到配置文件的最末尾,加上以下配置信息:



代碼如下:


[eaccelerator]
zend_extension="/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"
eaccelerator.shm_size="128"
eaccelerator.cache_dir="/usr/local/webserver/eaccelerator_cache"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="300"
eaccelerator.shm_prune_period="120"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"



修改配置文件:
vi /etc/sysctl.conf
kernel.shmmax = 134217728
然后執(zhí)行以下命令使配置生效:/sbin/sysctl -p



感謝各位的閱讀,以上就是“centos5源碼安裝Nginx、mysql和php的方法”的內(nèi)容了,經(jīng)過(guò)本文的學(xué)習(xí)后,相信大家對(duì)centos5源碼安裝Nginx、mysql和php的方法這一問(wèn)題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是創(chuàng)新互聯(lián)網(wǎng)站建設(shè)公司,,小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!


分享文章:centos5源碼安裝Nginx、mysql和php的方法-創(chuàng)新互聯(lián)
本文鏈接:http://weahome.cn/article/dijijd.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部