编译环境安装
1 2 3
| # yum install -y gcc gcc-c++ make gd-devel libxml2 libxml2-devel \ libcurl libcurl-devel libjpeg-devel libpng-devel openssl-devel \ libxslt-devel bzip2 bzip2-devel freetype-devel
|
PHP获得
1 2
| # cd /usr/src # wget http://docs.php.net/distributions/php-5.6.38.tar.gz
|
编译安装PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| # tar zxvf php-5.6.38.tar.gz # cd php-5.6.38.tar.gz
# ./configure --prefix=/usr/local/php \ --with-config-file-path=/usr/local/php/etc \ --enable-fpm --enable-opcache \ --with-mysql --with-mysqli \ --enable-session --with-zlib --with-curl --with-gd \ --with-jpeg-dir --with-png-dir --with-freetype-dir \ --enable-mbstring --enable-xmlwriter --enable-xmlreader \ --enable-xml --enable-sockets --enable-bcmath --with-gettext
# make -j 4 && make install
|
PHP配置文件
1 2
| # cp php.ini-production /usr/local/php/etc/php.ini # cp sapi/fpm/php-fpm.conf /usr/local/php/etc/php-fpm.conf
|
PHP启动服务设置
1 2 3
| # cp sapi/fpm/php-fpm.service /usr/lib/systemd/system/
# vi /usr/lib/systemd/system/php-fpm.service
|
替换路径:/usr/local/php/
1 2 3 4 5 6 7 8 9 10 11 12 13
| [Unit] Description=The PHP FastCGI Process Manager After=syslog.target network.target
[Service] Type=simple PIDFile=/usr/local/php/var/run/php-fpm.pid ExecStart=/usr/local/php/sbin/php-fpm --nodaemonize --fpm-config /usr/local/php/etc/php-fpm.conf ExecReload=/bin/kill -USR2 $MAINPID
[Install] WantedBy=multi-user.target
|
设置完成后可通过systemctl命令启动/关闭php服务:
1 2
| # systemctl start php-fpm # ps -ef | grep php
|