• php5.6安装及php-fpm优化配置


    1,安装依赖包:

    yum install -y gcc gcc-c++  zlib zlib-devel pcre pcre-devel  gd libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers mcrypt libmcrypt libmcrypt-devel mhash

    2,php安装:

    wget –c http://cn2.php.net/distributions/php-5.6.14.tar.gz

    tar –zxf php-5.6.14.tar.gz

    cd php-5.6.14

    ./configure  --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc --enable-fpm --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-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-gettext --disable-fileinfo --enable-opcache 

    make

    make install

    cp php.ini-development /usr/local/php5/etc/php.ini

    cp /usr/local/php5/etc/php-fpm.conf.default  /usr/local/php5/etc/php-fpm.conf

    /usr/local/php5/sbin/php-fpm

    提示如下:

     

     

    这里添加的库文件路径一定要和你系统平台arch一致,32bit的系统直接添加/usr/local/lib即可,64bit系统要填加/usr/local/lib64.否则依旧会报错,我当时就是添加了/usr/local/lib死活编辑不了,后来更改为/usr/local/lib64才可以

     

    优化:

    vim /usr/local/php5/etc/php.ini
    memory_limit = 256M
    date.timezone = 'UTC'
    post_max_size = 32M
    max_execution_time = 600
    upload_max_filesize = 16M
    max_input_time = 600

    echo "[Zend Opcache]" >>/usr/local/php5/lib/php.ini

    echo "zend_extension=opcache.so">>/usr/local/php5/lib/php.ini

    echo "opcache.memory_consumption=128">>/usr/local/php5/lib/php.ini

    echo "opcache.interned_strings_buffer=8">>/usr/local/php5/lib/php.ini

    echo "opcache.max_accelerated_files=4000">>/usr/local/php5/lib/php.ini

    echo "opcache.revalidate_freq=60">>/usr/local/php5/lib/php.ini

    echo "opcache.fast_shutdown=1">>/usr/local/php5/lib/php.ini

    echo "opcache.enable_cli=1">>/usr/local/php5/lib/php.ini

    php-fpm的线上配置文件可以参考一下: 

    vim /usr/local/php5/etc/php-fpm.conf

    [global]

    pid = /usr/local/php5/var/run/php-fpm.pid

    error_log = /usr/local/php5/var/log/php-fpm.log

    log_level = notice

    [www]

    listen = 127.0.0.1:9000

    listen.backlog = -1

    listen.allowed_clients = 127.0.0.1

    listen.owner = 10jqka

    listen.group = 10jqka

    listen.mode = 0666

    user = 10jqka

    group = 10jqka

    pm = dynamic

    pm.max_children = 1024

    pm.start_servers = 50

    pm.min_spare_servers = 50

    pm.max_spare_servers = 1024

    request_terminate_timeout = 100

    request_slowlog_timeout = 0

    slowlog = /usr/local/php5/var/log/slow.log

     

    最后定义环境变量:

                  echo "export PATH=$PATH:/usr/local/php5/bin" >>/etc/profile

    source /etc/profile

  • 相关阅读:
    UMLChina-我不经意的创业故事
    oracle management server
    关于做PDF的FAQ(一)~(四)
    关于学习ASP和编程的28个观点
    JavaScript的方法和技巧
    在公告栏里加进啦Google自定义搜索引擎(附代码,和参考代码,原代码)
    来北京工作了,有写感慨
    asp.net 2.0 访问oracle
    利用SharpZipLib进行文件的压缩和解压缩
    软件工程师,请不要做浮躁的人
  • 原文地址:https://www.cnblogs.com/zhangan/p/10910448.html
Copyright © 2020-2023  润新知