linux:php安装
程序员文章站
2022-03-30 20:21:45
1. 安装基础依赖 2. 下载源码包 3.cd php-7.2.7 4.配置 5.make && make install 6.配置文件 # cp php.ini-development /usr/local/php/lib/php.ini # cp /usr/local/php/etc/php-f ......
1. 安装基础依赖
apt-get install libxml2-dev libssl-dev libbz2-dev libjpeg-dev libpng-dev libxpm-dev libfreetype6-dev libgmp-dev libgmp3-dev libmcrypt-dev libpspell-dev librecode-dev libcurl4-gnutls-dev libgmp-dev libgmp3-dev librecode-dev libpspell-dev libmcrypt-dev libreadline-dev libtidy-dev libxslt1-dev -y
2. 下载源码包
cd /usr/local/src wget http://cn2.php.net/distributions/php-7.2.7.tar.gz tar -xzvf php-7.2.7.tar.gz
3.cd php-7.2.7
4.配置
./configure --enable-fpm --prefix=/usr/local/php --sysconfdir=/usr/local/php/etc --with-config-file-path=/usr/local/php/etc --with-config-file-scan-dir=/usr/local/php/etc/php.d --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-gd --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --with-bz2 --enable-soap --without-pear
5.make && make install
6.配置文件
# cp php.ini-development /usr/local/php/lib/php.ini
# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
# cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
# cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
# cp -r ./sapi/fpm/php-fpm /etc/init.d/php-fpm
需要注意的是php7中www.conf这个配置文件配置phpfpm的端口号等信息,如果你修改默认的9000端口号需在这里改,再改nginx的配置
启动
# /etc/init.d/php-fpm
# /etc/init.d/php-fpm
上一篇: 幽默才子把你笑蒙圈