首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式碼之家 >> 編程語言 >  >> 網頁程式設計 >> PHP 程式設計 >> PHP 綜合知識

CentOS 5 編譯安裝 Nginx 1.4 + PHP 5.5 FastCGI 完整流程

     編輯:PHP 綜合知識

從原始碼編譯安裝高效能 LEMP 環境,含依賴套件、libiconv、GD、MySQL、PHP-FPM、Nginx 完整參數。

1. 安裝編譯依賴

yum -y install gcc gcc-c++ autoconf 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 openldap openldap-devel nss_ldap openldap-clients openldap-servers gettext-devel libXpm-devel libtool libevent libevent-devel gd-devel gd libmcrypt libmcrypt-devel pcre pcre-devel

2. libiconv

tar zxvf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/service/libiconv
make && make install

3. MySQL 5.5(cmake)

groupadd mysql; useradd -g mysql -s /sbin/nologin mysql
cmake . -DCMAKE_INSTALL_PREFIX=/service/mysql -DMYSQL_DATADIR=/data/mysql ...(其它參數略)
make && make install
cp support-files/my-large.cnf /service/mysql/my.cnf
chown -R mysql:mysql /data/mysql /service/mysql
/service/mysql/bin/mysqld_safe --defaults-file=/service/mysql/my.cnf --basedir=/service/mysql --datadir=/data/mysql --user=mysql &

4. PHP 5.5(內建 mysqlnd)

groupadd webroot; useradd -g webroot -s /sbin/nologin webroot
./configure --prefix=/service/php --with-config-file-path=/service/php/etc --with-gd --enable-gd-native-ttf --enable-gd-jis-conv --with-jpeg-dir --with-png-dir --with-freetype-dir --with-mcrypt --with-zlib-dir --with-xpm-dir --enable-xml --with-curl --with-zlib --enable-exif --with-bz2 --with-libxml-dir --enable-mbstring --enable-sockets --enable-zip --enable-ftp --with-iconv-dir=/service/libiconv --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-fpm --with-fpm-user=webroot --with-fpm-group=webroot --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql=mysqlnd --enable-dom --with-libdir=lib64
make && make install
cp php.ini-production /service/php/etc/php.ini
cp /service/php/etc/php-fpm.conf.default /service/php/etc/php-fpm.conf
/service/php/sbin/php-fpm

5. 驗證 PHP-FPM

netstat -lanp | grep php-fpm
# tcp  0  0 127.0.0.1:9000  LISTEN  5483/php-fpm
ps -ef | grep php
# master process 與 worker processes

後續

尚需編譯安裝 Nginx 並設定 fastcgi_pass 127.0.0.1:9000 完成整合。

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved