我的linux學習之旅: (3)編譯安裝php5.4

來源:互聯網
上載者:User

標籤:虛擬機器主機   linux   作業系統   local   

編譯安裝php5.4

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/57/76/wKioL1Sax0mDBBbIAAIy9bKixY4327.jpg" title="圖片6.png" alt="wKioL1Sax0mDBBbIAAIy9bKixY4327.jpg" /> 

目標:編譯完成php5.4,並安裝xcache。配合http2.4實現一個虛擬機器主機

作業系統CentOS6.6 x32_64

 

安裝中使用的檔案

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/57/76/wKioL1Sax2bRc-FFAADYFvLsww4336.jpg" title="圖片1.png" alt="wKioL1Sax2bRc-FFAADYFvLsww4336.jpg" /> 

/etc/sysconfig/network-scripts/ifcfg-eth0 配置

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/57/76/wKioL1Sax3KAH-y5AAGTiJo_nYQ887.jpg" title="圖片2.png" alt="wKioL1Sax3KAH-y5AAGTiJo_nYQ887.jpg" />


650) this.width=650;" width="1" height="1" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/themes/default/images/word.gif") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />650) this.width=650;" width="1" height="1" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/themes/default/images/word.gif") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />650) this.width=650;" width="1" height="1" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/themes/default/images/word.gif") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />650) this.width=650;" width="1" height="1" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/themes/default/images/word.gif") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />650) this.width=650;" width="1" height="1" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/themes/default/images/word.gif") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />開始編譯安裝

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/57/79/wKiom1Sax2uiTG11AAA8pyJaTyM414.jpg" title="圖片3.png" alt="wKiom1Sax2uiTG11AAA8pyJaTyM414.jpg" />

安裝完畢啟動服務

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/57/76/wKioL1Sax6ix16BeAAChENoEuiQ482.jpg" title="圖片4.png" alt="wKioL1Sax6ix16BeAAChENoEuiQ482.jpg" />

按慣例上指令碼php.sh

#!/bin/bashphp=php-5.4.31xcache=xcache-3.1.0# 本機IPip=172.16.32.231# php安裝路徑path=/usr/local/php5# php分頁檔的存放位置webdire=/web[ -d $webdire ] || mkdir -p $webdireyum groupinstall -y "Development tools" "Server Platform Development"yum install -y bzip2-devel libmcrypt-devel libxml2-develtar xf $php.tar.gztar xf $xcache.tar.bz2[ -d /etc/php.d ] || mkdir -p /etc/php.dcd $php./configure --prefix=$path --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-openssl --enable-mbstring --with-freetype-dir --with-jpeg-dir--with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml--enable-sockets --enable-fpm --with-mcrypt--with-config-file-path=/etc/php --with-config-file-scan-dir=/etc/php/php.d --with-bzmake && make install# 設定檔cp php.ini-production /etc/php.ini# 開機開機檔案cp sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpmchmod +x /etc/rc.d/init.d/php-fpmchkconfig --add php-fpmchkconfig php-fpm oncp $path/etc/php-fpm.conf.default $path/etc/php-fpm.conf sed -i "s/listen.*9000/listen = $ip:9000/" $path/etc/php-fpm.conf# xcache installcd $xcache/usr/local/php5/bin/phpize./configure --enable-xcache --with-php-config=$path/bin/php-configmake && make install > tmp.txtxca=`grep -o ‘/.*$‘ tmp.txt`sed -i "[email protected]\(xcache.so\)@$xca/\[email protected]" xcache.inicp xcache.ini /etc/php.d/cd -service php-fpm star

在/web目錄下建立一個php檔案 index.php


650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/57/7F/wKioL1Sb-gHxzxnKAAB8XfArfHI387.jpg" title="捕獲.PNG" alt="wKioL1Sb-gHxzxnKAAB8XfArfHI387.jpg" />

配置www1主機

web.sh

#!/bin/bash# 開啟sslrpm -ql mod_ssl &>>/dev/null || yum install -y mod_sslconfile=/etc/httpd24/httpd.conf[ -f $confile.bak ] && cp $confile.bak $confile# 載入模組sed -i ‘[email protected]#*\(LoadModule ssl_module modules/mod_ssl.so\)@\[email protected]‘ $confilesed -i "[email protected]#*ServerName www.example.com:[email protected] `echo $HOSTNAME`@" $confile# phpsed -i ‘s/DirectoryIndex index.html/DirectoryIndex index.php index.html/‘ $confilesed -i "[email protected]#\(LoadModule proxy_module modules/mod_proxy.so\)@\[email protected]" $confilesed -i "[email protected]#\(LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so\)@\[email protected]" $confilegrep ‘x-httpd-php‘ $confile || sed -i "[email protected]\(AddType application/x-gzip .gz .tgz\)@\1\n    AddType application/x-httpd-php  .php\n    AddType application/x-httpd-php-source  [email protected]" $confile# 虛擬機器主機目錄docroot=/web/vhosts# 日誌目錄logpath=/var/log/httpd# php伺服器的ip地址phpip=172.16.32.231# 虛擬機器主機名web1=vul.test.comcat >> $confile <<EOF<VirtualHost *:80>DocumentRoot $docroot/www1ServerName $web1ErrorLog $logpath/www1.errCustomLog $logpath/www1.access combined<Directory $docroot/www1 >Options NoneRequire ip 172.16</Directory>ProxyRequests Off  ProxyPassMatch ^/(.*\.php)$ fcgi://$phpip:9000/web/$1</VirtualHost>EOF[ -d $docroot/www1 ] || mkdir -p $docroot/www1[ -d $logpath ] || mkdir -p $logpath cat > $docroot/www1/index.html <<EOFthis is $web1EOF# 如果開啟selinux的話運行下面的語句#chcon -R -u system_u -r object_r -t httpd_sts_content_t /webservice httpd24 restart

在DNSMaster添加vul=172.16.32.241 並將序號+1

修改指令碼dns.sh

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/57/81/wKiom1Sb_ezRJ9juAAG3g4IVI4E690.jpg" title="無標題.png" alt="wKiom1Sb_ezRJ9juAAG3g4IVI4E690.jpg" />

/var/named/test.com.zone 

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/57/7F/wKioL1Sb_F7hwEowAAJRenPWQeA106.jpg" title="無標題.png" alt="wKioL1Sb_F7hwEowAAJRenPWQeA106.jpg" />


ok,已正常工作。

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/57/7F/wKioL1Sb_a2CUwSaAAMEqXA7dkM506.jpg" title="無標題.png" alt="wKioL1Sb_a2CUwSaAAMEqXA7dkM506.jpg" />


本文出自 “ttqq” 部落格,請務必保留此出處http://473008.blog.51cto.com/463008/1596065

我的linux學習之旅: (3)編譯安裝php5.4

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.