CentOS6.4下編譯安裝Apache2.4+PHP5.6
安裝Apache2.4: 首先從 http://httpd./download.cgi#apache24
下載apache源碼包httpd-2.4.4.tar.gz
從 http://apr./download.cgi 下載
apr-1.4.6.tar.gz和apr-util-1.5.1.tar.gz
從 http:///projects/pcre/files/pcre/8.32/ 下載
pcre-8.32.tar.gz
打開終端切到root
su
輸入密碼
先裝gcc和make
yum -y install gcc
yum -y install make
yum -y install gcc-c++ 沒有這個(gè)gcc-c++一會(huì)編譯不prce
切到下載好的源碼包目錄,本人是~/Download
安裝apr:
tar -zvxf apr-1.4.6.tar.gz
cd apr-1.4.6
./configure --prefix=/usr/local/apr
make && make install
安裝apr-util
tar -zvxf apr-util-1.5.1.tar.gz
cd apr-util-1.5.1
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install
安裝pcre
tar -zvxf pcre-8.32.tar.gz
cd pcre-8.32
./configure
make && make install
安裝apache 一定要先裝上面那三個(gè)不然編譯不了
tar -zvxf httpd-2.4.4.tar.gz
cd httpd-2.4.4
./configure --prefix=/usr/local/apache --with-apr-util=/usr/local/apr-util
make && make install
啟動(dòng)apache
/usr/local/apache/bin/httpd
安裝PHP5.5
yum -y install libxml2-devel 不裝這個(gè)編譯不了PHP5.5
從www.下載PHP5.5
本人下載的是php-5.5.0.tar.gz
切到下載目錄
tar -zvxf php-5.5.0.tar.gz
cd php-5.5.0
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc
--enable-fpm --enable-sysvsem --enable-sockets --enable-pcntl --enable-mbstring
--enable-mysqlnd --enable-opcache --enable-shmop --enable-zip
--enable-ftp --enable-gd-native-ttf --enable-wddx --enable-soap
make && make install
拷貝一份正式的php-fpm.conf
更多選項(xiàng)... ./configure --prefix=/usr/local/php
--with-config-file-path=/usr/local/php/etc --enable-fpm --enable-sysvsem
--enable-sockets --enable-pcntl --enable-mbstring --enable-mysqlnd
--enable-opcache --enable-shmop --enable-zip --with-mcrypt=/usr/local/libmcrypt/
--with-zlib=/usr/local/zlib/ --with-curl=/usr/local/curl/
--with-pcre-dir=/usr/local/pcre/ --with-t1lib=/usr/local/tlib/
--with-pdo-mysql=/usr/ --with-fpm-user=www --with-fpm-group=www
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
啟動(dòng)PHP:
/usr/local/php/sbin/php-fpm
編輯apache配置文件:
vim /usr/local/apache/conf/http.conf
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
把這兩行前面的#號(hào)去掉
在最下面加兩行:
ServerName 127.0.0.1
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/usr/local/apache/htdocs/$1
保存退出:wq
重啟Apache
/usr/local/apache/bin/apachectl restart
OK了,寫個(gè)phpinfo看效果吧
|