Linux安装PHP
更新:HHH   时间:2023-1-7


https://pan.baidu.com/s/1ed47EJaK9SgyeZVrdMTH0A //软件包百度云网盘地址

yum -y install \
libjpeg \
libjpeg-devel \
libpng libpng-devel \
freetype freetype-devel \
libxml2 \
libxml2-devel \
zlib zlib-devel \
curl curl-devel \
openssl openssl-devel

yum install bzip2 -y   //安装解压工具

yum install lrz* -y   //安装上传软件 

ls  //查看当前目录下有哪些文件

tar xjvf php-7.1.10.tar.bz2   //解压软件包
ls  //查看当前目录下有哪些文件

cd php-7.1.10   //进入这个文件夹

./configure \
--prefix=/usr/local/php \
--with-mysql-sock=/usr/local/mysql/mysql.sock \
--with-mysqli \
--with-zlib \
--with-curl \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-openssl \
--enable-mbstring \
--enable-xml \
--enable-session \
--enable-ftp \
--enable-pdo \
--enable-tokenizer \
--enable-zip \
--enable-fpm
如果报一下错误
装一下yum install gcc -y 就行了

make  //编译
make install   //编译并且安装
cp php.ini-development /usr/local/php/lib/php.ini  //把 php.ini-development拷贝到/usr/local/php/lib/php.ini文件目录里面

vi /usr/local/php/lib/php.ini   //进入配置文件修改以下内容
mysqli.default_socket = /usr/local/mysql/mysql.sock
date.timezone = Asia/Shanghai
/usr/local/php/bin/php -m //验证安装的模块

返回云计算教程...