首页 关于 归档

安装php7

安装php7

why

都说php7性能大增

安装

➜ /sbin/groupadd www 
➜ /usr/sbin/useradd -g www www

# 安装依赖
➜ yum install -y gcc-c++ autoconf libjpeg \
libjpeg-devel libpng libpng-devel freetype freetype-devel \
libpng libpng-devel libxml2 libxml2-devel zlib zlib-devel \
glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses \
curl openssl-devel gdbm-devel db4-devel libXpm-devel libX11-devel \
gd-devel gmp-devel readline-devel libxslt-devel expat-devel \
xmlrpc-c xmlrpc-c-devel libicu-devel libmcrypt-devel libmemcached-devel

➜ cd php-7.0.13
➜ ./configure --prefix=/usr/local/php-7 \
--with-config-file-path=/usr/local/php-7/etc  \
--with-mysqli=shared,mysqlnd \
--with-pdo-mysql=shared,mysqlnd \
--with-iconv-dir \
--with-zlib \
--with-freetype-dir=/usr/lib64/ \
--with-jpeg-dir=/usr/lib64/ \
--with-png-dir=/usr/lib64/ \
--with-libxml-dir=/usr/lib64/ \
--enable-xml \
--disable-rpath \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \ 
--with-curl \
--enable-mbregex \ 
--enable-fpm \
--enable-mbstring \
--with-mcrypt=/usr/local/libmcrypt \
--with-gd \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash=/usr/local/mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-soap \
--without-pear \
--enable-zip \
--with-bz2 \
--enable-calendar \
--enable-ftp \
--enable-ctype \
--enable-exif \
--with-sqlite3 \
--with-gettext \
--with-pcre-dir \
--enable-pdo \
--enable-opcache \
--enable-shared \
--disable-debug \
--enable-session \
--without-gdbm \
--disable-fileinfo
➜ make
➜ make install
➜ ln -sf /usr/local/php-7 /usr/local/php
➜ cp php.ini-production /usr/local/php-7/etc/php.ini
➜ cp /usr/local/php-7/etc/php-fpm.conf.default /usr/local/php-7/etc/php-fpm.conf
➜ cp /usr/local/php-7/etc/php-fpm.d/www.conf.default /usr/local/php-7/etc/php-fpm.d/www.conf
# 修改vim /usr/local/php-7/etc/php-fpm.d/www.conf

user = www
group = www
listen = /dev/shm/php7-cgi.sock

#启动php-fpm,mac必须要以root用户启动,-R 参数表示 --allow-to-run-as-root
➜ /usr/local/php/sbin/php-fpm

➜ ps aux | grep php
root      1028  0.0  0.0 207664  6352 ?        Ss   17:52   0:00 php-fpm: master process (/usr/local/php-7/etc/php-fpm.conf)
www       1029  0.0  0.0 207664  5792 ?        S    17:52   0:00 php-fpm: pool www          
www       1030  0.0  0.0 207664  5792 ?        S    17:52   0:00 php-fpm: pool www

Author: josephzeng

Date: <2016-12-13 Tue>

Generated by Emacs 24.5.1 (Org mode 8.2.10)

Last Updated <2016-12-13 Tue>

Validate