CentOS7/RHEL7上源码搭建LAMP

番外篇:添加PHP扩展项目

  • MemcacheMemcached扩展
    #Server
    cd
    wget http://www.memcached.org/files/memcached-1.4.24.tar.gz
    tar zxf memcached-1.4.24.tar.gz -C /usr/local/src/
    cd /usr/local/src/memcached-1.4.24/
    CFLAGS="-fPIC -O3" ./configure --enable-64bit
    make -j `cat /proc/cpuinfo | grep processor | wc -l`;make install
    memcached -d -u apache

    #Client
    cd
    wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
    tar zxf libmemcached-1.0.18.tar.gz -C /usr/local/src/
    cd /usr/local/src/libmemcached-1.0.18/
    CFLAGS="-fPIC -O3" ./configure --with-memcached=/usr/local/
    make -j `cat /proc/cpuinfo | grep processor | wc -l`;make install

    #Extensions
    cd
    wget http://pecl.php.net/get/memcache-3.0.8.tgz
    tar zxf memcache-3.0.8.tgz -C /usr/local/src/
    cd /usr/local/src/memcache-3.0.8/
    /usr/local/php5/bin/phpize
    CFLAGS="-fPIC -O3" ./configure --with-php-config=/usr/local/php5/bin/php-config --enable-memcache --with-zlib-dir=/usr/local/
    make -j `cat /proc/cpuinfo | grep processor | wc -l`;make install
    echo 'extension=/usr/local/php5/lib/php/extensions/no-debug-zts-20131226/memcache.so' >> /usr/local/php5/php.ini
    cd
    wget http://pecl.php.net/get/memcached-2.2.0.tgz
    tar zxf memcached-2.2.0.tgz -C /usr/local/src/
    cd /usr/local/src/memcached-2.2.0/
    /usr/local/php5/bin/phpize
    CFLAGS="-fPIC -O3" ./configure --with-php-config=/usr/local/php5/bin/php-config --enable-memcached --with-libmemcached-dir=/usr/local/ --with-zlib-dir=/usr/local/ --disable-memcached-sasl
    make -j `cat /proc/cpuinfo | grep processor | wc -l`;make install
    echo 'extension=/usr/local/php5/lib/php/extensions/no-debug-zts-20131226/memcached.so' >> /usr/local/php5/php.ini
    /usr/local/apache/bin/apachectl restart

    MemCached
  • imagemagick扩展:
    #本体
    wget http://www.imagemagick.org/download/ImageMagick-6.9.2-0.tar.xz
    tar Jxf ImageMagick-6.9.2-0.tar.xz -C /usr/local/src/
    cd /usr/local/src/ImageMagick-6.9.2-0/
    PKG_CONFIG_LIBDIR=/usr/local/lib/pkgconfig/:/usr/local/freetype/lib/pkgconfig/ CPPFLAGS="-I/usr/local/jpeg9/include/ -I/usr/local/include/fontconfig/ -I/usr/local/libxml2/include/libxml2/" LDFLAGS="-L/usr/local/jpeg9/lib/ -L/usr/local/lib -L/usr/local/libxml2/lib" CFLAGS="-fPIC -O3" ./configure --prefix=/usr/local/imagemagick --enable-opencl
    make -j `cat /proc/cpuinfo | grep processor | wc -l`;make install

    #Extensions
    wget http://pecl.php.net/get/imagick-3.3.0RC2.tgz
    tar zxf imagick-3.3.0RC2.tgz -C /usr/local/src/
    cd /usr/local/src/imagick-3.3.0RC2/
    /usr/local/php5/bin/phpize
    CFLAGS="-fPIC -O3" ./configure --with-php-config=/usr/local/php5/bin/php-config --with-imagick=/usr/local/imagemagick/
    make -j `cat /proc/cpuinfo | grep processor | wc -l`;make install
    echo 'extension=/usr/local/php5/lib/php/extensions/no-debug-zts-20131226/imagick.so' >> /usr/local/php5/php.ini
    /usr/local/apache/bin/apachectl restart

    imagick

其它扩展添加方式类同,就不一一演示了。

发表评论

error: Content is protected !!