作者:淡水鱼yw灬s | 来源:互联网 | 2023-05-19 10:25
1.下载php-5.6.36.tar.gz2.解压tar-zxvfphp-5.6.36.tar.gz3.进入php目录cdphp-5.6.364.
1.下载php-5.6.36.tar.gz
2.解压
tar -zxvf php-5.6.36.tar.gz
3.进入php目录
cd php-5.6.36
4.执行configure
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=mysqlnd --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-freetype-dir --with-png-dir --with-iconv-dir --with-zlib-dir --with-mcryp --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --disable-ipv6 --with-pear --with-curl --with-openssl
报错xml2-config not found. Please check your libxml2 installation
安装xml2
yum install libxml2
yum install libxml2-devel -y
报错Please reinstall the libcurl distribution -easy.h should be in /include/curl/
yum -y install curl-devel
报错png.h not found.
yum install libpng-devel
报错freetype-config not found
yum install freetype-devel
5.make && make install
6.复制php.ini配置文件到指定目录
cp php.ini-development /usr/local/php/etc/php.ini
cd /usr/local/php/etc
cp ./php-fpm.conf.default ./php-fpm.conf
7.设置软连接
ln -sf /usr/local/php/sbin/php-fpm /usr/bin/php
8.添加www用户和组
groupadd www
useradd -g www www
9.编辑php-fpm.conf文件,将user和group设置为www
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
user = www
group = www
10.启动php服务
cd /usr/local/php/sbin
./php-fpm