鲲鹏云服务器源码安装php7
PHP即“超文本预处理器”,是一种通用开源脚本语言。PHP是在服务器端执行的脚本语言,与C语言类似,是常用的网站编程语言。PHP独特的语法混合了C、Java、Perl以及 PHP 自创的语法。利于学习,使用广泛,主要适用于Web开发领域。
环境要求
云服务器要求
本文以KC1实例测试,配置如表 云服务器配置所示。
项目 |
说明 |
规格 |
kc1.large.2 | 2vCPUs | 4GB |
磁盘 |
系统盘:高IO(40GB) |
操作系统要求
操作系统要求如表 操作系统要求所示。
项目 |
说明 |
下载地址 |
CentOS |
7.6 |
在公共镜像中已提供。 |
Kernel |
4.14.0-115 |
在公共镜像中已提供。 |
配置编译环境
安装相关依赖
yum install libxml2-devel openssl openssl-devel curl curl-devel libjpeg libjpeg-devel freetype freetype-devel libpng libpng-devel libxslt libxslt-devel pcre pcre-devel bzip2 bzip2-devel httpd-devel libzip libzip-devel -y
获取源码
获取“php7.2.13”源码包。
cd /usr/local/src
wget https://www.php.net/distributions/php-7.2.13.tar.gz
编译和安装
解压软件包
tar -zxvf php-7.2.13.tar.gz && cd php-7.2.13
生成Makefile文件
./configure --prefix=/usr/local/php --exec-prefix=/usr/local/php --bindir=/usr/local/php/bin --sbindir=/usr/local/php/sbin --includedir=/usr/local/php/include --libdir=/usr/local/php/lib/php --mandir=/usr/local/php/php/man --with-config-file-path=/usr/local/php/etc --with-mysql-sock=/var/lib/mysql/mysql.sock --with-mhash --with-openssl --with-mysqli=shared,mysqlnd --with-pdo-mysql=shared,mysqlnd --with-gd --with-jpeg-dir --with-png-dir --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-pcntl --enable-sockets --with-xmlrpc --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-freetype-dir --enable-opcache --enable-fpm --with-fpm-user=www --with-fpm-group=www --without-gdbm --enable-fileinfo --with-apxs2=/usr/bin/apxs --disable-fileinfo
编译php
make -j4 && make install
建立软连接
ln -s /usr/local/php/sbin/php-fpm /usr/local/bin
ln -s /usr/local/php/bin/php /usr/bin/php
运行和验证
查看php版本信息
php -v
回显类似如下信息说明php编译成功
PHP 7.3.15 (cli) (built: Mar 7 2020 19:47:46) ( NTS )Copyright (c) 1997-2018 The PHP GroupZend Engine v3.3.15, Copyright (c) 1998-2018 Zend Technologies
- 点赞
- 收藏
- 关注作者
评论(0)