逆思維調用雙版本PHP7和5

來源:互聯網
上載者:User

標籤:cal   一句話   項目   iso   yum   遇到   rpc   load   develop   

一、前言

1.前言

上一個部落格是基於PHP5安裝PHP7,調用雙版本的PHP。現在由於項目環境的不一樣,導致是最新版本的PHP7環境,部署老版本的項目,使用新版本的PHP去調用舊的PHP項目,會報錯的。最明顯的報錯就是“no input file specified”,每次遇到這個問題,首先想到的就是PHP版本的問題,然後再排其他的錯。這次是在新環境中調用老版本的PHP,前提是保持原來的項目不受影響,所以為了不影響其他項目不受影響,優先考慮連接埠佔用,而服務進程的管理者,伺服器網路狀態,記憶體和CPU的佔用等等。

有一句話就是“好的判斷來自於經驗,而經驗來自於錯誤的決定”,所以趁年輕,擁有更多時間去思考和反省,進而總結經驗。

二、安裝

1.下載,解壓,安裝環境包
PHP5軟體包下載

連結:https://pan.baidu.com/s/13WmYZKI_Mo3VUBbwBNcs_w 密碼:j8hj

環境依賴包安裝:
yum install gcc bison bison-devel zlib-devel libmcrypt-devel mcrypt mhash-devel openssl-devel libxml2-devel libcurl-devel bzip2-devel readline-devel libedit-devel sqlite-devel jemalloc jemalloc-devel

2.先行編譯
./configure ‘--prefix=/usr/local/php5‘ ‘--with-config-file-path=/usr/local/php5/etc‘ ‘--with-config-file-scan-dir=/usr/local/php5/conf.d‘ ‘--enable-fpm‘ ‘--with-fpm-user=www‘ ‘--with-fpm-group=www‘ ‘--with-mysql=mysqlnd‘ ‘--with-mysqli=mysqlnd‘ ‘--with-pdo-mysql=mysqlnd‘ ‘--with-iconv-dir‘ ‘--with-freetype-dir=/usr/local/php5/freetype‘ ‘--with-jpeg-dir‘ ‘--with-png-dir‘ ‘--with-zlib‘ ‘--with-libxml-dir=/usr‘ ‘--enable-xml‘ ‘--disable-rpath‘ ‘--enable-bcmath‘ ‘--enable-shmop‘ ‘--enable-sysvsem‘ ‘--enable-inline-optimization‘ ‘--with-curl‘ ‘--enable-mbregex‘ ‘--enable-mbstring‘ ‘--with-mcrypt‘ ‘--enable-ftp‘ ‘--with-gd‘ ‘--enable-gd-native-ttf‘ ‘--with-openssl‘ ‘--with-mhash‘ ‘--enable-pcntl‘ ‘--enable-sockets‘ ‘--with-xmlrpc‘ ‘--enable-zip‘ ‘--enable-soap‘ ‘--with-gettext‘ ‘--disable-fileinfo‘ ‘--enable-opcache‘ ‘--enable-intl‘ ‘--with-xsl‘

3.編譯並安裝
make && make install

4.佈建服務

#設定檔# cp php.ini-development /usr/local/php5/etc/php.ini#php-fpm 服務# cp /usr/local/php5/etc/php-fpm.conf.default /usr/local/php5/etc/php-fpm.conf# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm5# chmod +x /etc/init.d/php-fpm5# chkconfig --add php-fpm5# service php-fpm5 start  

5.環境變數

# vim /etc/profilePATH=$PATH:/usr/local/php5/binexport PATH# source /etc/profile  

6.修改nginx的設定檔

#        include enable-php.conf;      location ~ \.php$ {            # 設定監聽連接埠            fastcgi_pass   127.0.0.1:9000;            # 設定nginx的預設首頁檔案(上面已經設定過了,可以刪除)            fastcgi_index  index.php;            # 設定指令檔請求的路徑            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;            # 引入fastcgi的設定檔            include        fastcgi_params;        }

7.重啟NGINX服務
nginx -s reload

逆思維調用雙版本PHP7和5

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.