zoukankan      html  css  js  c++  java
  • [转载]编译安装PHP 5.3.8 + memcache + eaccelerator + PDO_MYSQL + Imagemagick + imagick

    访问phpinfo页面,可以正常显示内容,访问静态内容同样正常显示,因此怀疑是PHP程序的问题。于是今天删掉所有通过yum安装的php包,全部手动编译一遍,首先

    yum remove php*
    

    接着从php开始

    mkdir /usr/local/webserver
    
    wget http://cn.php.net/get/php-5.3.8.tar.bz2/from/this/mirror
    tar jfvx php-5.3.8.tar.bz2
    
    cd php-5.3.8
    ./configure --prefix=/usr/local/websever/php  --with-config-file-path=/usr/local/websever/php/etc  --with-mysql  --with-zlib   --enable-fpm  --with-gd --with-mcrypt --with-openssl --enable-zip --enable-sockets  --enable-mbregex --enable-xml --enable-safe-mode --enable-bcmath --enable-shmop --with-mhash --with-curl --with-xmlrpc --enable-soap
    
    make
    make install
    

    #接下来要拷贝一些默认的配置文件

    cp php.ini-production /usr/local/websever/php/etc/php.ini
    cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
    chmod +x /etc/init.d/php-fpm
    cp sapi/fpm/php-fpm.conf /usr/local/websever/php/etc/
    

    接着开始编译一个扩展模块 首先是memcache。要让memecache能正常工作,需要首先安装memcached并启动该服务,可以通过一下方式完成

    yum install memcached
     memcached -d -m 1024 -u root -l 127.0.0.1 -p 11211
    

    然后就可以开始安装memcache了

    wget http://pecl.php.net/get/memcache-2.2.5.tgz
    tar zfvx memcache-2.2.5.tgz
    cd memcache-2.2.5
     
    /usr/local/websever/php/bin/phpize
     
    ./configure --with-php-config=/usr/local/websever/php/bin/php-config
    make
    make install
    

    接着是eaccelerator

    wget http://sourceforge.net/projects/eaccelerator/files/eaccelerator/eAccelerator%200.9.6.1/eaccelerator-0.9.6.1.tar.bz2/download
    tar jfvx eaccelerator-0.9.6.1.tar.bz2 
    cd eaccelerator-0.9.6.1
     
    /usr/local/websever/php/bin/phpize
     
    ./configure --enable-eaccelerator=shared --with-php-config=/usr/local/websever/php/bin/php-config 
    make 
    make install
    

    接着是PDO_MYSQL

    wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz
    tar zfvx PDO_MYSQL-1.0.2.tgz
    cd PDO_MYSQL-1.0.2
     
    /usr/local/websever/php/bin/phpize
     
    ./configure --with-php-config=/usr/local/websever/php/bin/php-config 
    make
    make install
    

    最后是ImageMagick和imagick

    wget ftp://ftp.kddlabs.co.jp/graphics/ImageMagick/ImageMagick-6.6.9-10.tar.bz2
    tar jfvx ImageMagick-6.6.9-10.tar.bz2 
    cd ImageMagick-6.6.9-10
     
    ./configure
    make
    make install
     
    wget http://pecl.php.net/get/imagick-3.0.1.tgz
    tar zfvx imagick-3.0.1.tgz
    cd imagick-3.0.1
     
    /usr/local/websever/php/bin/phpize
     
    ./configure --with-php-config=/usr/local/websever/php/bin/php-config
    make
    make install
    

    最后需要修改php.ini和php-fpm.conf两个文件 在php.ini文件中添加以下字段

    extension_dir = "/usr/local/websever/php/lib/php/extensions/no-debug-non-zts-20090626/"
    
    extension = "memcache.so"
    extension = "pdo_mysql.so"
    extension = "imagick.so"
    
    [eaccelerator]
    zend_extension=/usr/local/websever/php/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so"
    eaccelerator.shm_size="32"
    eaccelerator.cache_dir="/usr/local/webserver/eaccelerator_cache"
    eaccelerator.enable="1"
    eaccelerator.optimizer="1"
    eaccelerator.check_mtime="1"
    eaccelerator.debug="0"
    eaccelerator.filter=""
    eaccelerator.shm_max="0"
    eaccelerator.shm_ttl="3600"
    eaccelerator.shm_prune_period="3600"
    eaccelerator.shm_only="0"
    eaccelerator.compress="1"
    eaccelerator.compress_level="9"
    

    然后修改php-fpm.conf,取消对以下行的注释

    [global]
    pid = run/php-fpm.pid
    error_log = log/php-fpm.log
    emergency_restart_threshold = 0
    
    [www]
    listen = 127.0.0.1:9000
    
    listen.allowed_clients = 127.0.0.1
    user = nobody
    group = nobody
    pm = dynamic
    pm.max_children = 50
    pm.start_servers = 10
    pm.min_spare_servers = 5
    pm.max_spare_servers = 35
    

    现在你就可以通过

    service php-fpm start
    

    来启动php-fpm进程了!

  • 相关阅读:
    React元素渲染
    初识JSX
    微信小程序复制文本到剪切板
    微信小程序报错request:fail url not in domain list
    小程序,通过自定义编译条件,模拟推荐人功能
    积分抵扣逻辑
    微信小程序 switch 样式
    tomcat 配置开启 APR 模式
    tomcat8 传输json 报错 Invalid character found in the request target. The valid characters are defined in RFC 3986
    c++数组初始化误区
  • 原文地址:https://www.cnblogs.com/milton/p/4215062.html
Copyright © 2011-2022 走看看