Deepin V20 编译安装 PHP8

下载 PHP8

打开官网下载地址 https://www.php.net/downloads 选择最新版本下载。

image-20210406001708174.png

下载完毕后解压文件到当前文件夹

tar -xvf php-8.0.3.tar.gz

然后进入解压好的文件夹

cd ./php-8.0.3

环境安装

在一般的安装教程中都是直接给你命令,复制回车就能装,但是在我这里,我安装的时候并没有直接使用别人文章里的那些命令,没有直接复制粘贴安装而是出现什么缺少就安装什么,下方是我遇到的报错。
最好的解决错误方法就是当出现错误后百度查找答案然后解决他,在安装 php 的过程中一般都是缺少某个软件包导致不能安装,所以一般就是百度找到对应的软件包然后安装上。

安装命令

./configure --help 可以看到所有的编译参数
./configure --prefix=/usr/local/php8.0.3/ \
--enable-mysqlnd \
--with-pdo-mysql \
--enable-bcmath \
--enable-fpm \
--with-fpm-user=www-data \
--with-fpm-group=www-data \
--enable-mbstring \
--enable-phpdbg \
--enable-shmop \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--with-zip=/usr/bin/zip \
--with-zlib \
--with-curl \
--with-pear \
--with-openssl \
--enable-pcntl

遇到的问题

仅供参考

checking for openssl >= 1.0.1... no
configure: error: Package requirements (openssl >= 1.0.1) were not met:

No package 'openssl' found

sudo apt-get install libssl-dev

checking for sqlite3 > 3.7.4... no
configure: error: Package requirements (sqlite3 > 3.7.4) were not met:

No package 'sqlite3' found

sudo apt-get install libsqlite3-dev

checking for libcurl >= 7.29.0... no
configure: error: Package requirements (libcurl >= 7.29.0) were not met:

No package 'libcurl' found

sudo apt-get install libcurl4-openssl-dev

checking for oniguruma... no
configure: error: Package requirements (oniguruma) were not met:

No package 'oniguruma' found

sudo apt-get install libonig-dev

checking for libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0... no
configure: error: Package requirements (libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0) were not met

No package 'libzip' found

sudo apt-get install libzip-dev

添加新评论

仅有一条评论

  1. 好人啊