- 论坛徽章:
- 0
|
1.安装apache fastcgi模块 mod_fastcgi下载地址:http://www.fastcgi.com/dist/
tar -zxvf mod_fastcgi-current.tar.gz cd mod_fastcgi-2.4.6 cp Makefile.AP2 Makefile make top_dir=/path/to/apache2 #你的apache安装路径或者直接编辑Makefile[则不需加top_dir参数] make install top_dir=/path/to/apache2
2.安装php-fpm 在安装PHP-FPM编译的时候会报找不到libevent,可以执行 yum -y install libevent* wget http://www.monkey.org/~provos/libevent-1.4.12-stable.tar.gz tar zxvf libevent-1.4.12-stable.tar.gz cd libevent-1.4.12 ./configure --prefix=$prefix mak && make install
tar -jxvf php-5.3.3.tar.bz2 cd php-5.3.3 ./configure \ --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc \ --with-mysql=/usr/local/mysql/ --with-mysqli=/usr/local/mysql/bin/mysql_config \ --with-zlib --with-curl --with-jpeg-dir --with-freetype-dir --with-png-dir \ --with-libxml-dir=/usr/ --with-gd --with-openssl \ --with-openssl --with-ldap --with-ldap-sasl --with-xmlrpc --without-pear \ --enable-xml --enable-gd-native-ttf \ --enable-ctype --enable-calendar --enable-inline-optimization \ --enable-magic-quotes --with-bz2 --enable-mbstring \ --enable-fpm --enable-safe-mode --enable-bcmath --enable-shmop \ --enable-sysvsem --enable-mbregex --enable-mbstring --enable-pcntl \ --enable-zip --enable-ftp --enable-sockets --enable-soap --with-libevent-dir=/usr make && make install
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm chmod +x /etc/init.d/php-fpm
cp -r sapi/fpm/php-fpm.conf /usr/local/etc/ 配置php-fpm.conf文件中相关参数
启动php-fpm /etc/init.d/php-fpm start
3.修改apache,让apache支持php-fpm vi httpd.conf add LoadModule fastcgi_module modules/mod_fastcgi.so 在vhosts.conf文件的项目中加入以下 ScriptAlias /cgi-bin/ "/map/app/php5_poi/bin/" FastCgiExternalServer /map/app/php5_poi/bin/php-fpm -host 127.0.0.1:9000 #php由外部的fastcgi来处理 AddType application/x-httpd-php .php AddHandler php5-fastcgi .php Action php5-fastcgi /cgi-bin/php-fpm #Action php5-fastcgi /cgi-bin/php-fpm中的php-fpm一定要和FastCgiExternalServer中的文件名一样.而且/cgi-bin/和前面的ScriptAlias的路径也要一样,两句放一块就是说上面的映射也就是所有的.php文件都由/cgi-bin/php-fpm 处理 否則會出錯的. <Directory "/map/app/php5_poi/bin/"> Options -Indexes FollowSymLinks +ExecCGI Order allow,deny Allow from all </Directory> 加完以上的,安装完成了。但是php-fpm.conf配置文件需要优化 |
|