lnmp搭建之php5.5.34的安裝

來源:互聯網
上載者:User
1.下載php5.5.34版本的php

解壓

2.建立php-fpm使用者

useradd -s /sbin/nologin php-fpm

3. cd php5.5.34

執行:

4.編譯:【借鑒阿明linux的配置選項】

./configure \--prefix=/usr/local/php \--with-config-file-path=/usr/local/php/etc \--enable-fpm \--with-fpm-user=php-fpm \--with-fpm-group=php-fpm \--with-mysql=/usr/local/mysql \--with-mysql-sock=/tmp/mysql.sock \--with-libxml-dir \--with-gd \--with-jpeg-dir \--with-png-dir \--with-freetype-dir \--with-iconv-dir \--with-zlib-dir \--with-mcrypt \--enable-soap \--enable-gd-native-ttf \--enable-ftp \--enable-mbstring \--enable-exif \--enable-zend-multibyte \--disable-ipv6 \--with-pear \--with-curl \--with-openssl

2.編譯/安裝後

1)拷貝設定檔

cp php.ini-production /usr/local/php/etc/php.ini

2)拷貝指令碼:

cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm 可以去編輯的只是一個啟動的shell指令碼

3)修改許可權php-fpm

授予其執行的許可權:

chmod 755 /etc/init.d/php-fpm

chkconfig --add php-fpm

chkconfig php-fpm on

4) 啟動, service php-fpm start

注意設定檔: php-fpm.conf

5)啟動之前你也可以檢查一下設定檔的正確性:

/usr/local/php/sbin/php-fpm -t

6)啟動

流程下來,覺得mysql的安裝有點類似。

錯誤以及解決方案:

1.configure: error: no acceptable C compiler found in $PATH

See `config.log' for more details

yum install -y gcc

2.

configure: error: xml2-config not found. Please check your libxml2 installation.

yum install -y libxml2.x86_64 libxml2-devel.x86_64
3.configure: error: Cannot find OpenSSL's 

yum install -y openssl.x86_64 openssl-devel.x86_64

4.

error: Please reinstall the libcurl distribution -

easy.h should be in /include/curl/

yum install -y curl.x86_64 libcurl-devel.x86_64

5.checking whether to enable JIS-mapped Japanese font support in GD... no

If configure fails try --with-vpx-dir=

yum install libjpeg.x86_64 libpng.x86_64 freetype.x86_64 libjpeg-devel.x86_64 libpng-devel.x86_64 freetype-devel.x86_64 -y

測試結果:

6.

configure: error: jpeglib.h not found.

這個搓錯誤,不是安裝libjpeg 和libjpeg-devel

應該是:

yum install -y libjpeg-turbo.x86_64 libjpeg-turbo-devel.x86_64

7.

mcrypt.h not found. Please reinstall libmcrypt.

發現yum源沒有這個安裝包,就要擴充yum源了:

yum install -y epel-release.noarch

然後尋找檔案

yum install -y libmcrypt.x86_64 libmcrypt-devel.x86_64

8.

error: Cannot find MySQL header files under /usr/local/mysql.

Note that the MySQL client library is not bundled anymore!

9.啟動的時候的錯誤:

[root@ip5 php-5.5.34]# service php-fpm start

Starting php-fpm [27-Apr-2016 17:24:21] ERROR: failed to open configuration file '/usr/local/php/etc/php-fpm.conf': No such file or directory (2)

[27-Apr-2016 17:24:21] ERROR: failed to load configuration file '/usr/local/php/etc/php-fpm.conf'

[27-Apr-2016 17:24:21] ERROR: FPM initialization failed

failed

說明是沒有啟動php-fpm 的設定檔,那麼,我們只需要去其安裝路徑中重新命名:php-fpm.conf.defult 重名為:php-fpm.conf

10.啟動php的-fpm的時候,出現:

啟動php-fpm的時候,這個提示不知道為啥?
[root@daiqing php-5.5.31]# service php-fpm start
Starting php-fpm [14-Jan-2016 06:16:59] ERROR: [pool www] cannot get uid for user 'php-fpm'
[14-Jan-2016 06:16:59] ERROR: FPM initialization failed
failed

原因分析i:

建立使用者沒有成功,useradd -s /sbin/nologin php-fpm

11.編譯的時候i,出現參數:

--enable-zend-multibyte :

該編譯參數已經不存在了。

12. 查看php的編譯參數:

/usr/local/php/bin/php -i |head

  • 聯繫我們

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