Freebsd10.3 Nginx多版本PHP

來源:互聯網
上載者:User

標籤:mysql   sql   curl   sock   工作   php70   mha   擴充   ash   

伺服器上需要使用多個php版本,費了好幾天勁,終於有所收穫。記錄如下:

1.下載php-5.5.37.tar.bz2。

2.tar zvxf  php-5.5.37.tar.bz2 -C /usr/local/php55(如果上述目錄不存在,建立一個吧)

3.進入php-5.5.37目錄。

4../configure --prefix=/usr/local/php55 --with-config-file-path=/usr/local/php55/etc --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/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-intl --with-xsl

系統開始配置,如果配置過程中出現某個擴充不存在,直接pkg install 副檔名。(特別是提示ICU不存在,請直接pkg install ICU,一般還需要安裝libmcrypt,libxslt),配置完成後最好make test;

5.make ZEND_EXTRA_LIBS=‘-liconv‘

6.make install

嗯,基本差不多了。然後,需要做一些後續工作,我們來設定php5.5的監聽連接埠為9001;

1.將/usr/local/php55/php-5.5.37/sapi/fpm/init.d.php-fpm這個檔案複製為/etc/rc.d/php-fpm

2.編輯/usr/local/php55/etc/php-fpm.conf,設定監聽連接埠為9001

3.運行php-fpm.(/etc/rc.d/php-fpm start

4.在nginx.conf中配置一個網站,使用9001連接埠來解析php,然後service nginx restart

人品不錯的話,基本成功。

然後安裝php70,這個就簡單多了,上一篇文章中已經說過了,值得注意的是這時啟動php70,應該直接/usr/local/sbin/php-fpm,這時兩個php-fpm應該能同時使用。再用sockstat看一下監聽連接埠,9000和9001都存在了。

 

Freebsd10.3 Nginx多版本PHP

聯繫我們

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