PAPI-PHP7 Installation

Source: Internet
Author: User
Tags install redis

PHP7 Installation Scripts
#!/bin/bashwget http://cn2.php.net/distributions/php-7.0.7.tar.bz2tar jxvf php-7.0.7.tar.bz2  cd php-7.0.7mkdir -p /usr/local/php-7.0.7/etc/./configure --prefix=/usr/local/php-7.0.7 --with-config-file-scan-dir=/usr/local/php-7.0.7/etc/ --enable-inline-optimization --enable-opcache --enable-session --enable-fpm --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-pdo-sqlite --with-sqlite3 --with-gettext --enable-mbregex --enable-mbstring --enable-xml --with-iconv --with-mcrypt --with-mhash --with-openssl --enable-bcmath --enable-soap --with-xmlrpc --with-libxml-dir --enable-pcntl --enable-shmop --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-sockets --with-curl --with-curlwrappers --with-zlib --enable-zip --with-bz2 --with-gd --enable-gd-native-ttf --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-readline --with-fpm-user=www --with-fpm-group=wwwmake && make install #注意:在make的时候报undefined reference to `libiconv_open’的问题的解决方案vim Makefile## 找到 EXTRA_LIBS = 这行,在最后加上 -liconvmake && make install  cp php.ini* /usr/local/php-7.0.7/etc/cd /usr/local/php-7.0.7/etc/cp php.ini-development php.inicp php-fpm.conf.defaultphp-fpm.confcp php-fpm.d/www.conf.default php-fpm.d/www.conf # 其他配置sed -i s/‘variables_order = "GPCS"‘/‘variables_order = "EGPCS"‘/g /usr/local/php-7.0.7/etc/php.iniecho ‘date.timezone = PRC‘ >> /usr/local/php-7.0.7/etc/php.iniecho ‘extension_dir = "/usr/local/php-7.0.7/lib/php/extensions/no-debug-non-zts-20151012/"‘ >> /usr/local/php-7.0.7/etc/php.iniecho "/usr/local/php-7.0.7/sbin/php-fpm" >>  /etc/rc.localecho -e ‘\nexport PATH=/usr/local/php/bin:/usr/local/php/sbin:$PATH\n‘ >> /etc/profile && source /etc/profile
PHP7 Cache Extension Installation script
#!/bin/bashfunction install_status(){    if [ $? -eq 0 ];then        echo -e "\033[32m$1 successful!\033[0m"    else        echo -e "\033[31m$1 failed,please check it!\033[0m"    fi}function add_so_to_ini(){    EXTENSION=$1    cp -f /usr/local/php-${PHP_VERSION}/etc/php.ini  /usr/local/php-${PHP_VERSION}/etc/php.ini.bak && sed "/extension=${EXTENSION}.so/d" /usr/local/php-${PHP_VERSION}/etc/php.ini.bak > /usr/local/php-${PHP_VERSION}/etc/php.ini    echo "extension=${EXTENSION}.so" >> /usr/local/php-${PHP_VERSION}/etc/php.ini}PHP_VERSION=7.0.7#5.6.28#7.0.7echo ${PHP_VERSION} #memcachedunzip -o php-memcached-php7.zipcd php-memcached-php7/usr/local/php-7.0.7/bin/phpize./configure --enable-memcached --with-php-config=/usr/local/php-${PHP_VERSION}/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached  --disable-memcached-saslinstall_status ‘configure_memcached.so‘make && make installinstall_status ‘install_memcached.so‘add_so_to_ini memcached#memcacheunzip -o pecl-memcache-NON_BLOCKING_IO_php7.zipcd pecl-memcache-NON_BLOCKING_IO_php7/usr/local/php-7.0.7/bin/phpize./configure --with-php-config=/usr/local/php-${PHP_VERSION}/bin/php-config --enable-memcache --with-zlib-dirinstall_status ‘configure_memcache.so‘make && make installinstall_status ‘install_memcache.so‘add_so_to_ini memcache #redis/usr/local/php-${PHP_VERSION}/bin/pecl install redisinstall_status ‘install_redis.so‘add_so_to_ini redis

If memcached installation is unsuccessful when installing memcached and Redis, refer to the following methods to install the memcached

Installing memcached
1234567891011121314151617 #要安装 memcached,需要先安装依赖库 libmemcachedwget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gztar -zxf libmemcached-1.0.18.tar.gzcd libmemcached-1.0.18/./configuremake && make install#安装好依赖库之后,我们来安装 memcached :mkdir -p /usr/local/php-7.0.7/extgit clone -b php7 https://github.com/php-memcached-dev/php-memcached.git /usr/local/php-7.0.7/ext/memcachedcd /usr/local/php-7.0.7/ext/memcached/usr/local/php-7.0.7/bin/phpize./configure --enable-memcached --with-php-config=/usr/local/php-7.0.7/bin/php-config--disable-memcached-saslmake testmake && make installvim /usr/local/php-7.0.7/etc/php.ini    [Memcached]    extension=memcached.so

Refer to the method to install Redis

Installing Redis
1234 /usr/local/php-7.0.7/bin/peclinstall redis-3.1.0vi/usr/local/php-7.0.7/etc/php.ini    [Redis]    extension=redis.so

configuration www.conf (under PHP-FPM.D directory)
123456789 ; 设置用户和用户组,默认都是nobodyuser = wwwgroup = www; 设置PHP监听; 下面是默认值,不建议使用。可以默认值; listen = 127.0.0.1:9000; 根据nginx.conf中的配置fastcgi_pass  unix:/tmp/php7-cgi.sock;listen = /tmp/php7-cgi.sock

After you save the configuration file, verify that the configuration is correct by:

/usr/local/php-7.0.7/sbin/php-fpm -t

If such test is successful words appear, there is no problem with the configuration.

Start PHP-FPM
/usr/local/php-7.0.7/sbin/php-fpm 

Dependent Dependency Reference:

Http://www.cnblogs.com/52fhy/p/5797981.html

A variety of branching references on PHP7:

Https://github.com/gophp7/gophp7-ext/wiki/extensions-catalog

PAPI-PHP7 Installation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.