php 5.5.14 fastcgi安装
cd /web/soft/ mkdir php wget laomm.com/s/phpext.tar.gz tar xf phpext.tar.gz mkdir /usr/local/phpext tar xf libevent-2.0.21-stable.tar.gz cd libevent-2.0.21-stable ./configure --prefix=/usr/local/phpext make && make install tar xf freetype-2.4.12.tar.gz cd freetype-2.4.12 ./configure --prefix=/usr/local/phpext make && make install tar xf libpng-1.6.2.tar.gz cd libpng-1.6.2 ./configure --prefix=/usr/local/phpext make && make install tar xf jpegsrc.v9.tar.gz cd jpeg-9 ./configure --prefix=/usr/local/phpext --enable-shared --enable-static make && make install tar xf libiconv-1.14.tar.gz cd libiconv-1.14 ./configure --prefix=/usr/local/phpext make && make install tar xf mhash-0.9.9.9.tar.gz cd mhash-0.9.9.9 ./configure --prefix=/usr/local/phpext make && make install tar xf re2c-0.13.5.tar.gz cd re2c-0.13.5 ./configure make && make install tar xf libmcrypt-2.5.8.tar.gz cd libmcrypt-2.5.8 ./configure --prefix=/usr/local/phpext make && make install tar xf php-5.5.14.tar.gz cd php-5.5.14 ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fastcgi --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --disable-debug --disable-ipv6 --with-iconv-dir --with-freetype-dir=/usr/local/phpext --with-jpeg-dir=/usr/local/phpext --with-png-dir=/usr/local/phpext --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap make ZEND_EXTRA_LIBS='-liconv' make install cp php.ini-development /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 chkconfig --add php-fpm chkconfig php-fpm on cd /usr/local/php/etc/ cp php-fpm.conf.default php-fpm.conf vi php-fpm.conf rlimit_files = 51200 #和 ulimit -a open files 的值 保持一直 user= www #php-fpm运行用户 group= www #php-fpm运行用户组 pm = dynamic #pm参数指定了进程管理方式,有两种可供选择:static或dynamic,如果是静态方式,那么在php-fpm启动的时候就创建了指定数目的进程,在运行过程中不会再有变化(并不是真的就永远不变);而动态的则在运行过程中动态调整,当然并不是无限制的创建新进程,受pm.max_spare_servers参数影响;动态适合小内存机器,灵活分配进程,省内存。静态适用于大内存机器,动态创建回收进程对服务器资源也是一种消耗. pm.max_children = 24 #static模式下创建的子进程数或dynamic模式下同一时刻允许最大的php-fpm子进程数 pm.start_servers = 16 #动态方式下的起始php-fpm进程数量 pm.min_spare_servers = 12 #动态方式下服务器空闲时最小php-fpm进程数量 pm.max_spare_servers = 24 #动态方式下服务器空闲时最大php-fpm进程数量 #一般php-fpm进程占用20~30m左右的内存就按30m算。如果单独跑php-fpm,动态方式起始值可设置物理内存Mem/30M,由于大家一般Nginx、MySQL都在一台机器上,于是预留一半给它们,即php-fpm进程数为$Mem/2/30. nginx 中支持php 方法如下 打开nginx.conf 在http{ }中加入以下内容 server { listen 80; server_name localhost; root /wwwroot/web/web; index index.html index.htm index.php; location ~ [^/]\.php(/|$) { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
目录 返回
首页