php_lib_download(){ for i in "$PHP_LIBICONV_VERSION.tar.gz" "$PHP_LIBMCRYPT_VERSION.tar.gz" "$PHP_MHASH_VERSION.tar.gz" "$PHP_MCRYPT_VERSION.tar.gz" do if [ -s packages/$i ]; then echo "$i [found]" else echo "Error: $i not found!!!download now......" wget http://www.paopao8.com/docs/soft/lnmp/packages/$i -P packages/ fi done } php_lib_install(){ cd packages/ tar zxvf $PHP_LIBICONV_VERSION.tar.gz cd $PHP_LIBICONV_VERSION ./configure --prefix=/usr/local && make && make install cd .. tar zxvf $PHP_LIBMCRYPT_VERSION.tar.gz cd $PHP_LIBMCRYPT_VERSION/ ./configure --prefix=/usr && make && make install cd libltdl/ ./configure --enable-ltdl-install make && make install cd ../../ tar zxvf $PHP_MHASH_VERSION.tar.gz cd $PHP_MHASH_VERSION ./configure --prefix=/usr && make && make install ldconfig cd ../ ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4 ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8 ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2 ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1 #ln -sf lib ln -sf /usr/lib64/libjpeg.so /usr/lib/ ln -sf /usr/lib64/libpng.so /usr/lib/ ln -sf /usr/lib64/libldap* /usr/lib/ tar zxvf $PHP_MCRYPT_VERSION.tar.gz cd $PHP_MCRYPT_VERSION /sbin/ldconfig ./configure --prefix=/usr && make && make install cd .. echo "/usr/lib" >> /etc/ld.so.conf echo "/usr/local/lib" >> /etc/ld.so.conf ldconfig cd ../ } php_download(){ for i in "$PHP_VERSION.tar.gz" \ "$PHP_FPM_VERSION.diff.gz" \ "$PHP_SUHOSIN_VERSION.patch.gz" \ "$PHP_MAX_INPUT_VARS.patch.gz" \ "$PHP_APC_VERSION.tgz" \ "$PHP_EAC_VERSION.tar.bz2" \ "$PHP_LIB_VERSION.tar.gz" \ "$PHP_MC_EXT_VERSION.tgz" \ "$PHP_MCD_EXT_VERSION.tgz" \ "$PHP_MCD_VERSION.tar.gz" \ "$PHP_LIBMC_VERSION.tar.gz" \ "$PHP_IMAGICK_SOFT.tar.gz" \ "$PHP_IMAGICK_VERSION.tgz" do if [ -s packages/$i ]; then echo "$i [found]" else echo "Error: $i not found!!!download now......" wget http://www.paopao8.com/docs/soft/lnmp/packages/$i -P packages/ fi done } php_fastcgi_init_script(){ cat > /etc/init.d/fastcgi < $PHP_PREFIX/etc/php-fpm.conf < All relative paths in this config are relative to php's install prefix
Pid file $PHP_PREFIX/logs/php-fpm.pid Error log file $PHP_PREFIX/logs/php-fpm.log Log level notice When this amount of php processes exited with SIGSEGV or SIGBUS ... 10 ... in a less than this interval of time, a graceful restart will be initiated. Useful to work around accidental curruptions in accelerator's shared memory. 1m Time limit on waiting child's reaction on signals from master 5s Set to 'no' to debug fpm yes
Name of pool. Used in logs and stats. default Address to accept fastcgi requests on. Valid syntax is 'ip.ad.re.ss:port' or just 'port' or '/path/to/unix/socket' 127.0.0.1:9000 Set listen(2) backlog -1 Set permissions for unix socket, if one used. In Linux read/write permissions must be set in order to allow connections from web server. Many BSD-derrived systems allow connections regardless of permissions. 0666 Additional php.ini defines, specific to this pool of workers. /usr/sbin/sendmail -t -i 0 Unix user of processes $PHP_FPM_USER Unix group of processes $PHP_FPM_GROUP Process manager settings Sets style of controling worker process count. Valid values are 'static' and 'apache-like' static Sets the limit on the number of simultaneous requests that will be served. Equivalent to Apache MaxClients directive. Equivalent to PHP_FCGI_CHILDREN environment in original php.fcgi Used with any pm_style. $PHP_FPM_MAX_CHILDREN Settings group for 'apache-like' pm style Sets the number of server processes created on startup. Used only when 'apache-like' pm_style is selected 20 Sets the desired minimum number of idle server processes. Used only when 'apache-like' pm_style is selected 5 Sets the desired maximum number of idle server processes. Used only when 'apache-like' pm_style is selected 35 The timeout (in seconds) for serving a single request after which the worker process will be terminated Should be used when 'max_execution_time' ini option does not stop script execution for some reason '0s' means 'off' 30s The timeout (in seconds) for serving of single request after which a php backtrace will be dumped to slow.log file '0s' means 'off' 5s The log file for slow requests logs/slow.log Set open file desc rlimit 65535 Set max core size rlimit 0 Chroot to this directory at the start, absolute path Chdir to this directory at the start, absolute path Redirect workers' stdout and stderr into main error log. If not set, they will be redirected to /dev/null, according to FastCGI specs yes How much requests each process should execute before respawn. Useful to work around memory leaks in 3rd party libraries. For endless request processing please specify 0 Equivalent to PHP_FCGI_MAX_REQUESTS $PHP_FPM_MAX_REQUESTS Comma separated list of ipv4 addresses of FastCGI clients that allowed to connect. Equivalent to FCGI_WEB_SERVER_ADDRS environment in original php.fcgi (5.2.2+) Makes sense only with AF_INET listening socket. 127.0.0.1 Pass environment variables like LD_LIBRARY_PATH All \$VARIABLEs are taken from current environment \$HOSTNAME /usr/local/bin:/usr/bin:/bin /tmp /tmp /tmp \$OSTYPE \$MACHTYPE 2
EOF } php_install() { cd packages/ #gzip -d $PHP_SUHOSIN_VERSION.patch.gz tar zxvf $PHP_VERSION.tar.gz gzip -cd $PHP_FPM_VERSION.diff.gz | patch -d $PHP_VERSION -p1 cd $PHP_VERSION #patch -p 1 -i ../$PHP_SUHOSIN_VERSION.patch patch -p1 < ../php-5.2.17-max-input-vars.patch if [ $1 == "with_mysql" ];then $PHP_COMPILE_COMMAND_WITH_MYSQL check_sucess php $? else machine=`uname -m` if [ $machine == "x86_64" ];then export LDFLAGS=-L/usr/lib64/mysql fi $PHP_COMPILE_COMMAND_WITHOUT_MYSQL check_sucess php $? fi make ZEND_EXTRA_LIBS='-liconv' -j8 make install cp -Rf php.ini-dist $PHP_PREFIX/etc/php.ini cd ../../ php_fpm_conf } php_ext_install() { cd packages/ tar zxvf $PHP_LIB_VERSION.tar.gz cd $PHP_LIB_VERSION ./configure && make -j9 && make install cd .. tar zxvf $PHP_MCD_VERSION.tar.gz cd $PHP_MCD_VERSION ./configure --prefix=$PHP_MCD_PREFIX make -j9 && make install cd .. # php mecache.so tar zxvf $PHP_MC_EXT_VERSION.tgz cd $PHP_MC_EXT_VERSION $PHP_PREFIX/bin/phpize ./configure --with-php-config=$PHP_PREFIX/bin/php-config make -j8 && make install cd .. # php memached.so tar zxvf $PHP_LIBMC_VERSION.tar.gz cd $PHP_LIBMC_VERSION ./configure --prefix=$PHP_LIBMC_PREFIX --with-memcached=$PHP_MCD_PREFIX/bin/memcached make -j9 && make install cd .. tar zxvf $PHP_MCD_EXT_VERSION.tgz cd $PHP_MCD_EXT_VERSION $PHP_PREFIX/bin/phpize ./configure --with-php-config=$PHP_PREFIX/bin/php-config --with-libmemcached-dir=$PHP_LIBMC_PREFIX make -j9 && make install cd ../ # imagic tar zxvf $PHP_IMAGICK_SOFT.tar.gz cd $PHP_IMAGICK_SOFT_VERSION/ $PHP_IMAGICK_COMPILE_COMMAND make -j9 && make install cd .. tar zxvf $PHP_IMAGICK_VERSION.tgz cd $PHP_IMAGICK_VERSION/ $PHP_PREFIX/bin/phpize ./configure --with-php-config=$PHP_PREFIX/bin/php-config make -j9 && make install cd ../../ } # % config php % php_config() { sed -i '/expose_php/ {s/On/Off/g};/magic_quo tes_gpc/ {s/On/Off/g};/upload_max_filesize/ {s/.*/upload_max_filesize = 10M/};/output_buffering/ {s/Off/On/g}' $PHP_PREFIX/etc/php.ini sed -i 's/error_reporting = E_ALL \& ~E_NOTICE/error_reporting = E_WARNING \& E_ERROR/g' $PHP_PREFIX/etc/php.ini sed -i '/display_errors/ {s/On/Off/g};/log_errors/ {s/Off/On/g};/short_open_tag/ {s/Off/On/g}' $PHP_PREFIX/etc/php.ini sed -i "s#;error_log = filename#error_log = /tmp/php-error.log#g" $PHP_PREFIX/etc/php.ini sed -i "s#;always_populate_raw_post_data = On#always_populate_raw_post_data = On#g" $PHP_PREFIX/etc/php.ini cat >>$PHP_PREFIX/etc/php.ini<>$PHP_PREFIX/etc/php.ini<>$PHP_PREFIX/etc/php.ini<>$PHP_PREFIX/etc/php.ini<