php 需要安裝的包
yum install -y gccgcc-c++ make zlib zlib-devel pcre pcre-devel libjpeg libjpeg-devellibpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibcglibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curlcurl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel
yum install libXpm-devel libtidy-devel curl-devel db4-devel expat-devel libxslt libxslt-devel libxml2 libxml2-devel curl
yum installlibjpeg-devel install libpng-develgmp-devel net-snmp-devellibxslt-devel sqlite-devel aspell-devel
yum install libX11-devel libXext-devel libXt-devel
yum install libxslt* -y
libodb-mysql-devel 支持php調(diào)用的,從系統(tǒng)光盤中提取出來使用rpmv –ivh 安裝,使用yum安裝的話會(huì)把mysql安裝上
soci-mysql-devel.
openldap openldap-devel nss_ldapopenldap-clients openldap-servers 如果配置ldap需要安裝的php依賴的包
[root@web1_lamp tool]# yum install -y libmcrypt-devel ## 這個(gè)包需要擴(kuò)展源進(jìn)行安裝
wget -c http://mirrors.aliyun.com/epel/6Server/x86_64/epel-release-6-8.noarch.rpm 6以上的系統(tǒng)中沒有這個(gè)安裝包
rpm -ivhlibmcrypt-devel-2.5.7-5.el5.x86_64.rpm –nodeps
rpm -ivh mysql-devel-5.1.73-3.el6_5.x86_64.rpm –nodeps 使用rpm 強(qiáng)制安裝mysql-devel 因?yàn)槲也恍枰猰ysql的rpm包
http://downloads.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz
[root@web1_lamptool]# useraddphp-fpm -s /sbin/nologin -M
[root@web1_lamp tool]# cd /soft/tool/
[root@web1_lamp tool]# tarzxf libmcrypt-2.5.8.tar.gz -C /usr/local/src/
[root@web1_lamp tool]# tarzxf libiconv-1.14.tar.gz -C /usr/local/src/
[root@web1_lamp tool]# tarzxf mcrypt-2.6.8.tar.gz -C /usr/local/src/
[root@web1_lamp tool]# cd/usr/local/src/libmcrypt-2.5.8/
[root@web1_lamplibmcrypt-2.5.8]# ./configure --prefix=/usr/local/libmcrypt 是一個(gè)加密算法庫
[root@web1_lamplibmcrypt-2.5.8]# make && make install
[root@web1_lamplibmcrypt-2.5.8]# cd /usr/local/src/libiconv-1.14/ 字符編碼轉(zhuǎn)換
[root@web1_lamplibiconv-1.14]# ./configure --prefix=/usr/local/libiconv
[root@web1_lamplibiconv-1.14]# make && make install
[root@web1_lamp mcrypt-2.6.8]# cd /soft/tool/
[root@web1_lamp tool]# tarzxf mhash-0.9.9.9.tar.gz -C /usr/local/src/
[root@web1_lamp tool]# cd/usr/local/src/mhash-0.9.9.9/
[root@web1_lampmhash-0.9.9.9]# ./configure --prefix=/usr/local/mhash
[root@web1_lampmhash-0.9.9.9]# make && make install
[root@web1_lampmhash-0.9.9.9]# cd /usr/local/src/mcrypt-2.6.8/
[root@web1_lampmcrypt-2.6.8]# ./configure --prefix=/usr/local/mcrypt--with-libiconv-prefix=/usr/local/libiconv --with-libmcrypt-prefix=/usr/local/libmcrypt
*** Could not run libmcrypt test program, checking why...
*** The test program compiled, but did not run. Thisusually means
*** that the run-time linker is not finding LIBMCRYPT orfinding the wrong
*** version of LIBMCRYPT. If it is not finding LIBMCRYPT,you'll need to set your
*** LD_LIBRARY_PATH environment variable, or edit/etc/ld.so.conf to point
*** to the installed location Also, make sure you have run ldconfig if that
*** is required on your system
***
*** If you have an old version installed, it is best toremove it, although
*** you may also be able to get things to work bymodifying LD_LIBRARY_PATH
***
configure: error: *** libmcrypt was not found
提示讓我去LD_LIBRARY_PATHenvironment variable, or edit /etc/ld.so.conf to point修改環(huán)境變量
在
[root@web2_lnmpmhash-0.9.9.9]# cat /etc/ld.so.conf 添加libmcrypt/lib的庫位置之后 ldconfig 以下即可解決
includeld.so.conf.d/*.conf
/usr/local/libmcrypt/lib
繼續(xù)報(bào)錯(cuò)configure: error: "You need at least libmhash 0.8.15 to compilethis program. http://mhash.sf.net/" 執(zhí)行以下三行命令解決
[root@web1_lamp mcrypt-2.6.8]# exportLD_LIBRARY_PATH=/usr/local/libmcrypt/lib:/usr/local/mhash/lib
[root@web1_lamp mcrypt-2.6.8]# exportLDFLAGS="-L/usr/local/mhash/lib/ -I/usr/local/mhash/include/"
[root@web1_lamp mcrypt-2.6.8]# exportCFLAGS="-I/usr/local/mhash/include/"
在安裝完mhash 之后使用ldconfig
[root@web2_lnmpmhash-0.9.9.9]# cat /etc/ld.so.conf 但是在ld.so.conf中解決不了mhash源碼版本對(duì)不上的問題
includeld.so.conf.d/*.conf
/usr/local/libmcrypt/lib
/usr/local/mhash/lib
Ldconfig 更新一下
[root@web2_lnmpmcrypt-2.6.8]# ./configure --prefix=/usr/local/mcrypt--with-libiconv-prefix=/usr/local/libiconv--with-libmcrypt-prefix=/usr/local/libmcrypt
[root@web2_lnmpmcrypt-2.6.8]# make && make install
[root@web1_lamptool]#tarzxf php-5.6.6.tar\ .gz -C /usr/local/src/soft/
[root@web1_lamp tool]# cd /usr/local/src/soft/php-5.6.6/
2.5.1 php 編譯
[root@web1_lamp tool]#tar zxfphp-5.6.6.tar\ .gz -C /usr/local/src/soft/
[root@web1_lamp tool]# cd /usr/local/src/soft/php-5.6.6/
[root@web1_lampphp-5.6.6]#
./configure \
--prefix=/usr/local/php \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-mysql=/usr/local/mysql \
--with-config-file-path=/usr/local/php/etc \
--with-mhash=/usr/local/mhash\
--with-mcrypt=/usr/local/mcrypt\
--enable-fpm \
--with-libxml-dir \
--with-openssl \
--with-zlib=/usr/local/zlib \
--with-curl \
--with-xmlrpc \
--with-libxml-dir \
--with-pcre-dir \
--enable-ftp \
--with-gd \
--with-jpeg-dir\
--with-png-dir\
--with-xpm-dir\
--with-freetype-dir\
--enable-gd-native-ttf\
--enable-gd-jis-conv\
--with-gmp\
--enable-intl\
--enable-mbstring\
--enable-sockets\
--enable-zip\
--enable-soap\
--enable-sockets\
--with-iconv=/usr/local/libiconv \
--with-pear\
--enable-short-tags\
--enable-mbstring\
--enable-static\
--with-xsl\
--enable-ftp\
--enable-bcmath \
--with-bz2\
--enable-inline-optimization \
--with-gettext \
--with-zend-vm=CALL\
--enable-zend-signals \
--enable-mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--enable-exif
最簡單直接的編譯結(jié)合nginx ./configure --enable-fpm --with-mysql
--enable-fastcgi(nginx+php編譯的時(shí)候需要開啟)
如果不安裝rpm -ivhlibmcrypt-devel-2.5.7-5.el5.x86_64.rpm –nodeps 的話會(huì)報(bào)錯(cuò),提示libmcrypt和mhash 未安裝,強(qiáng)制安裝好之后再去執(zhí)行./configure 預(yù)處理就解決了此類問題
報(bào)錯(cuò):used when making a shared object; recompilewith -fPIC
/usr/lib64/libmcrypt.a: could not readsymbols: Bad value
collect2: ld returned 1 exit status
make: *** [libphp5.la] Error
64位的系統(tǒng)需要單獨(dú)的去安裝zlib的包,可以去官網(wǎng)下載
http://www.zlib.net/如果不安裝的話就會(huì)報(bào)上面的錯(cuò)誤編譯的時(shí)候加參數(shù)CFLAGS="-O3-fPIC" ./configure --prefix=/usr/local/zlib使用64位元編譯, 繼續(xù)編譯還是報(bào)錯(cuò)。
分析原因得出,.a 是靜態(tài)結(jié)尾文件,提示我編譯的時(shí)候需要加-fpci 參數(shù),參考網(wǎng)站資料我指定庫的位置進(jìn)行編譯
參考http://blog.csdn.net/cserchen/article/details/5515974
https://bugs.php.net/search.php?cmd=display&search_for=segmentation&php_os=&php_os_not=&author_email=&bug_type=&boolean=0&bug_age=0&bug_updated=0&order_by=&direction=ASC&limit=All&phpver=&cve_id=&cve_id_not=&patch=&assign=&status=All&reorder_by=ts2 php每個(gè)系統(tǒng)的錯(cuò)誤信息
https://gorn.ch/archive/2007/11/01/leopard-native-apache-with-custom-64bit-php.html 有關(guān)64位系統(tǒng)安裝建議
經(jīng)過查看我本地的libmcrypt.a 未做軟鏈接,所以加載我靜態(tài)庫失敗,
[root@zabbixlib64]# ll -lih libmcrypt.so
41902lrwxrwxrwx 1 root root 18 Mar 6 20:34libmcrypt.so -> libmcrypt.so.4.4.7
解決
[root@zabbixlib]# pwd
/usr/local/libmcrypt/lib
[root@zabbixlib]# ln -s * /usr/lib64/ 之后重新編譯問題解決,
教訓(xùn)總結(jié):一般在編譯完軟件之后有報(bào)錯(cuò).so .a的問題的查看到對(duì)應(yīng)的.a .so動(dòng)態(tài)庫和靜態(tài)庫的路徑做一個(gè)軟鏈接到/lib64 /usr/lib64 這個(gè)路徑下,這是64位操作系統(tǒng)加載的庫路徑
不同的環(huán)境下搭建php需要的參數(shù)不同,根據(jù)自己的需要去選擇相應(yīng)的參數(shù)
備選參數(shù)
--with-mysqli=mysqlnd
--with-fpm-user=php-fpm \
--with-fpm-group=php-fpm \
--with-config-file-scan-dir=PATH Set the path where to scan forconfiguration files 配置文件路徑
--with-config-file-path=PATH Set the path in which to look for php.ini[PREFIX/lib] php.ini 文件路徑
--with-mysqli=/usr/local/mysql/bin/mysql_config \ 本地的mysql 鏈接
--with-mysqli=FILE Include MySQLi support. FILE isthe path to mysql_config. If no value or mysqlnd is passed
--enable-mysqlnd\
--with-pdo-mysql=/usr/local/mysql 如果不指定mysqld 將使用本地連接
--enable-embedded-mysqli 使用嵌入支持不適用mysql 本地
--with-mysql-sock=SOCKPATH 如果不指定,將默認(rèn)查找
--disable-fileinfo
內(nèi)存小于1G 需要加這個(gè)參數(shù)--disable-fileinfo 有提示了再加,省得最后報(bào)錯(cuò)
--enable-intl 選擇國際化標(biāo)準(zhǔn)安裝
configure: error: Unable todetect ICU prefix or no failed. Please verify ICU install prefix and make sureicu-config works. 因?yàn)槲疫x擇了國際標(biāo)準(zhǔn)所以老外都喜歡libic-devel
[root@web1_lampphp-5.6.6]# yuminstall perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker perl-ExtUtils-Embed libicu-devel
[root@web2_lnmp php-5.6.6]# make &&make install 安裝完信息,如果有提示警告之類的,需要解決警告之后make clean重新編譯
警告處理
http://php.net/results.php?q=%60libtool&l=es&p=all
libtool: install: warning:remember to run `libtool --finish /usr/local/src/php-5.6.6/libs' 就執(zhí)行可以,參照系統(tǒng)提示做就行了如果開發(fā)包安裝完整的話不會(huì)有報(bào)錯(cuò)的,這里的警告是使用libtool 創(chuàng)建庫函數(shù)
[root@web1_lamp php-5.6.6]# ll /usr/local/apache2/modules/*php* 檢查php是否生成支持php的.so 模塊
-rwxr-xr-x 1 root root 31172030 Feb 28 11:01/usr/local/apache2/modules/libphp5.so
[root@web1_lamp php-5.6.6]# grep libphp5 /usr/local/apache2/conf/httpd.conf
LoadModule php5_module modules/libphp5.so
2.5.2 配置php
[root@web1_lamp php-5.6.6]# cpphp.ini-production /etc/php.ini è cp php的配置文件到/etc/php.ini
[root@web1_lamp php-5.6.6]#cpsapi/fpm/init.d.php-fpm /etc/init.d/php-fpmè配置一個(gè)啟動(dòng)腳本
[root@web1_lamp php-5.6.6]# chmod 755 /etc/init.d/php-fpm è賦予執(zhí)行權(quán)限
[root@web1_lamp php-5.6.6]# chkconfig --addphp-fpm è添加到chkconfig
[root@web1_lampphp-5.6.6]# chkconfig --list php-fpm
php-fpm 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@web1_lampphp-5.6.6]# cd /usr/local/php/etc/
[root@web1_lamp etc]# cpphp-fpm.conf.default php-fpm.conf è配置php-fpm 配置文件可以使用默認(rèn)的就不需要修改了
[root@web1_lamp etc]# vimphp-fpm.conf è 可以使用默認(rèn)的,沒有需求的時(shí)候就不要去修改
[root@web1_lamp etc]# diffphp-fpm.conf php-fpm.conf.default
listen = 20.0.0.10:9000 定位listenip地址為別人可以訪問進(jìn)來的ip
25c25
< pid = run/php-fpm.pid
> ;pid = run/php-fpm.pid
235c235
< pm.max_children = 50
> pm.max_children = 5
240c240
< pm.start_servers = 5 改為5的就可以查看到5個(gè)站點(diǎn)的進(jìn)程
> pm.start_servers = 2
245c245
< pm.min_spare_servers = 3
> pm.min_spare_servers = 1
250c250
< pm.max_spare_servers = 8
> pm.max_spare_servers = 3
[root@web1_lamp etc]#/usr/local/php/sbin/php-fpm –t è測(cè)試配置文件是否正確
[28-Feb-2015 06:44:48] NOTICE: configurationfile /usr/local/php/etc/php-fpm.conf test is successful
[root@web2_lnmp etc]# /etc/init.d/php-fpmreload
Starting php-fpm
[root@web1_lamp etc]# ps aux |grep php-fpm
root 23108 0.0 1.0 72364 5144 ? Ss 22:47 0:00 php-fpm: masterprocess (/usr/local/php/etc/php-fpm.conf)
nobody 23109 0.0 0.9 72364 4452 ? S 22:47 0:00 php-fpm: poolwww
nobody 23110 0.0 0.9 72364 4452 ? S 22:47 0:00 php-fpm: poolwww
nobody 23111 0.0 0.9 72364 4452 ? S 22:47 0:00 php-fpm: poolwww
nobody 23112 0.0 0.9 72364 4452 ? S 22:47 0:00 php-fpm: poolwww
nobody 23113 0.0 0.9 72364 4452 ? S 22:47 0:00 php-fpm: poolwww
root 23115 0.0 0.1 103244 864 pts/0 S+ 22:47 0:00 grep php-fpm
[root@web2_lnmp etc]# ss -tunl | grep 9000
tcp LISTEN 0 128 20.0.0.10:9000 *:*
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。
網(wǎng)頁題目:php5.6.6源碼安裝配置-創(chuàng)新互聯(lián)
本文來源:http://jinyejixie.com/article42/jechc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供手機(jī)網(wǎng)站建設(shè)、移動(dòng)網(wǎng)站建設(shè)、網(wǎng)站策劃、微信公眾號(hào)、網(wǎng)站維護(hù)、企業(yè)建站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容