準備工作
建立一個軟件包目錄存放 mkdir -p /usr/local/src/ 清理已經安裝包 rpm -e httpd rpm -e mysql rpm -e php yum -y remove httpd yum -y remove mysql yum -y remove php #搜索apache包 rpm -qa http* #強制卸載apache包 rpm -e --nodeps 查詢出來的文件名 #檢查是否卸載干凈 rpm -qa|grep http* selinux可能會致使編譯安裝失敗,我們先禁用它。永久禁用,需要重啟生效 sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
臨時禁用,不需要重啟?setenforce 0
安裝必備工具
yum -y install make gcc gcc-c++ gcc-g77 flex bison file libtool libtool-libs autoconf kernel-devel libjpeg libjpeg-devel libpng libpng-devel libpng10 libpng10-devel gd gd-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glib2 glib2-devel bzip2 bzip2-devel libevent libevent-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel gettext gettext-devel ncurses-devel gmp-devel pspell-devel unzip libcap lsof
安裝Nginx
http://www.cnblogs.com/Easonlou/p/6638284.html
安裝MySQL
http://www.cnblogs.com/Easonlou/p/6646818.html
安裝PHP
Nginx是通過第三方的fastcgi處理器才可以對php進行解析,這點與nginx不同,apache對PHP的支持是通過apache的mod_php5模塊來支持的
下載:
wget http://cn2.php.net/get/php-5.5.35.tar.gz/from/this/mirror
修改名字&&解壓:
mv mirror php-5.5.35.tar.gz && tar xvf php-5.5.35.tar.gz
進入目錄:
cd php-5.5.35
編譯:
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --enable-xml --disable-rpath --enable-magic-quotes --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --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 --without-pear --with-gettext --disable-fileinfo --enable-maintainer-zts --with-kerberos --with-imap=/usr/lib64 --with-imap-ssl
安裝:
make && make install
PHP服務:
# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf # cp php.ini-devlopment /usr/local/php/etc/php.ini # cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm # chmod +x /etc/init.d/php-fpm
?