1.php官方下载地址:https://www.php.net/downloads.php
1.php7官方源码下载地址:https://www.php.net/distributions/php-7.1.9.tar.bz2
2.解压压缩包 tar -xjvf php-7.1.9.tar.bz2
3.php安装路径 ./configure --prefix=/mnt/h/swoole/php7.1.9/php
3. 安装请确保已经安装GCC ,autoconfig 没有请自行根据linux ubuntu 安装
4. make test 检测安装环境
5. make install 安装
[PEAR] Archive_Tar - already installed: 1.4.3
[PEAR] Console_Getopt - already installed: 1.4.1
[PEAR] Structures_Graph- already installed: 1.1.1
[PEAR] XML_Util - already installed: 1.4.2
[PEAR] PEAR - already installed: 1.10.5
Wrote PEAR system config file at: /mnt/h/swoole/php7.1.9/php/etc/pear.conf
You may want to add: /mnt/h/swoole/php7.1.9/php/lib/php to your php.ini include_path
/mnt/h/swoole/php7.1.9/php-7.1.9/build/shtool install -c ext/phar/phar.phar /mnt/h/swoole/php7.1.9/php/bin
ln -s -f phar.phar /mnt/h/swoole/php7.1.9/php/bin/phar
Installing PDO headers: /mnt/h/swoole/php7.1.9/php/include/php/ext/pdo/
显示上面 即为安装成功
转到php 安装bin目录
./bin/php -m 查看php安装扩展
简化php运行命令
vi ~/.bash_profile 编辑文件
输入 alias sphp7=/mnt/h/swoole/php7.1.9/php/bin/php alias 别名 = php bin目录
source ~/.bash_profile 生效配置
测试 sphp7 - v 显示下面即为成功
PHP 7.1.9 (cli) (built: Aug 23 2020 18:38:42) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
到php解压目录找到php.ini-development 复制到php安装目录的lib目录去,具体路径看编译php时是否指定路径,默认为lib 重命名为php.ini,sphp7 -i | grep php.ini 找到当前php配置的ini路径 把php.ini 移到相应目录。