Linux編譯安裝PHP Mysql Nginx

來源:互聯網
上載者:User

標籤:style   blog   http   io   color   ar   os   sp   for   

安裝gcc g++等編譯器

yum -y install gcc gcc-c++ automake autoconf libtool glibc make

 

 

安裝一些lnmp依賴的庫

 

yum -y install libmcrypt-devel mhash-devel libxslt-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel

 

 

好像centos 6.0 後都yum 安裝不了libmcrypt了
不解決這個問題,編譯不了php,~~~~安裝libmcrypt

tar -zxvf libmcrypt-2.5.7.tar.gz

 ./configure --prefix=/usr/local/libmcrypt

make && make install

 

-----------------------------------------------------------------------------------

make[2]: Leaving directory `/usr/local/src/libmcrypt-2.5.7/src‘

Making all in doc

make[2]: Entering directory `/usr/local/src/libmcrypt-2.5.7/doc‘

make[2]: Nothing to be done for `all‘.

make[2]: Leaving directory `/usr/local/src/libmcrypt-2.5.7/doc‘

make[2]: Entering directory `/usr/local/src/libmcrypt-2.5.7‘

make[2]: Leaving directory `/usr/local/src/libmcrypt-2.5.7‘

make[1]: Leaving directory `/usr/local/src/libmcrypt-2.5.7‘

-----------------------------------------------------------------------------

報這個錯沒關係,只要不是error就行,這個提示的意思是離開目前的目錄的意思。

 

安裝PHP

:http://php.net/downloads.php

 

tar -zxvf php-5.4.21.tar.gzcd php-5.4.21

 

./configure --prefix=/usr/local/php  --enable-fpm --with-mcrypt=/usr/local/libmcrypt --enable-mbstring --disable-pdo --with-curl --disable-debug  --disable-rpath --enable-inline-optimization --with-bz2  --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --with-mhash --enable-zip --with-pcre-regex --with-mysql --with-mysqli --with-gd --with-jpeg-dir

 

若出現報錯 參考 http://www.cnblogs.com/wangxusummer/p/4094340.html

 

make && make install

 

添加www使用者組,添加www使用者,並將www用記添加到www使用者組

groupadd wwwuseradd -g www www

 

 

拷貝php-fpm設定檔

 

cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

 

 

更改配製檔案

vim etc/php-fpm.conf 

 

25 行前面分號去掉 pid為php-fpm產生的進程號

148 149行,user group 都改為www

 pid = run/php-fpm.pid user = www group = www

 

 

拷貝php設定檔 到php預設的設定檔路徑

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

 

ln -s /usr/local/php/bin/php /usr/bin/php

測試

php -r "echo date(‘Y-m-d H:i:s‘);"

若出現時區錯誤

更改配製檔案

vim /usr/local/php/etc/php.ini 

 

919 行,時區改為PRC,就是中華人民共和國。

date.timezone = PRC

 

安裝 nginx

Linux編譯安裝PHP Mysql Nginx

聯繫我們

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