环境准备:centos7
安装扩展源:
sudo yum install -y release
安装基础支持
sudo yum install -y freetype-devel libevent libevent-devel libxml2 libxml2-devel ncurses ncurses-devel openssl openssl-devel libjpeg libjpeg-devel libpng libpng–devel zlib-devel bzip2 bzip2-devel libmcrypt libmcrypt-devel
configure
./configure --prefix=/usr/local/php7 --exec-prefix=/usr/local/php7 --bindir=/usr/local/php7/bin --sbindir=/usr/local/php7/sbin --includedir=/usr/local/php7/include --libdir=/usr/local/php7/lib/php --mandir=/usr/local/php7/php/man --with-config-file-path=/usr/local/php7/etc --with-mysql-sock=/usr/local/mysql/mysql.sock --with-mcrypt=/usr/include --with-mhash --with-openssl --with-mysqli=shared,mysqlnd --with-pdo-mysql=shared,mysqlnd --with-gd --with-iconv --with-zlib --enable-zip --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --enable-fpm --with-fpm-user=nginx --with-fpm-group=www --without-gdbm --disable-fileinfo --enable-opcache
make
make
安装(make install)
sudo make install
配置
复制php.ini文件
sudo cp php.ini-production /usr/local/php7/etc/php.ini
sudo vi /usr/local/php7/etc/php.ini
复制fpm配置文件
cd /usr/local/php7/etc
sudo mv php-fpm.conf.default php-fpm.conf
sudo mv php-fpm.d/www.conf.defualt php-fpm.d/www.conf
服务管理和开机启动
cd /usr/src/php-7.0.0/sapi/fpm
ls
# centos7 systemctl 管理
sudo php-fpm.service /usr/lib/systemd/system/
sudo systemctl enable php-fpm.service
sudo systemctl start php-fpm.service
# centos6 chkconfig 管理
sudo cp init.d.php-fpm /etc/init.d/php-fpm
sudo chmod +x /etc/init.d/php-fpm
sudo chkconfig --add php-fpm
sudo chkconfig php-fpm on
这样,就可以通过sevice php-fpm start将服务启动,然后ps -ef | grep php检查下进程试试。
相关链接