Ubuntu 18.04.5 LTS 安装php7.4报错

更新时间:2021-05-28 11:39:24


今天想给我的阿里云服务器(Ubuntu18.04)安装一个php7.4,由于安装了宝塔面板,所以应该一键安装完成的,但是安装的时候却报错了,报错如下:

checking for RAND_egd... no
checking for openssl >= 1.0.1... yes
checking for PCRE library to use... bundled
checking whether to enable PCRE JIT functionality... yes
checking whether Intel CET is enabled... no
checking whether to enable the SQLite3 extension... yes
checking for sqlite3 > 3.7.4... no
configure: error: Package requirements (sqlite3 > 3.7.4) were not met:

No package 'sqlite3' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables SQLITE_CFLAGS
and SQLITE_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
make: *** No targets specified and no makefile found.  Stop.
make: *** No rule to make target 'install'.  Stop.
========================================================
Ubuntu 18.04.5 LTS 
 \l
Bit:64 Mem:1993M Core:1 gcc:7.5.0 cmake:3.10.2
Linux 4.15.0-65-generic x86_64
ERROR: php-7.4.19 install failed.
安装失败,请截图以上报错信息发帖至论坛www.bt.cn/bbs求助

这是怎么回事呢? 可以看到有一句:

No package 'sqlite3' found

所以可以直接安装sqlite3:

apt-get install sqlite3

于是我又开始安装php7.4,再次报错:

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

No package 'openssl' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables OPENSSL_CFLAGS
and OPENSSL_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
make: *** No targets specified and no makefile found.  Stop.
make: *** No rule to make target 'install'.  Stop.
========================================================
Ubuntu 18.04.5 LTS 
 \l
Bit:64 Mem:1993M Core:1 gcc:7.5.0 cmake:3.10.2
Linux 4.15.0-65-generic x86_64
ERROR: php-7.4.19 install failed.
安装失败,请截图以上报错信息发帖至论坛www.bt.cn/bbs求助

又是报错:

No package 'openssl' found

那么就安装吧:

apt-get install libssl-dev

最后安装完成:


Build complete.
Don't forget to run 'make test'.

Installing shared extensions:     /www/server/php/74/lib/php/extensions/no-debug-non-zts-20190902/
Starting php-fpm  done

Ubuntu18.04php7.4.png

Ubuntu教程PHP