解决执行 pecl upgrade-all 提示 Error getting channel info from pear.php.net: Connection to `ssl://pear.php.net:443' failed:Connection to 'ssl://pecl.php.net:443' failed: Unable to find the socket 错误。

出现这个错误主要是因为缺失默认证书导致的,具体原因不明。

下面说一下解决方案:

1、查看 default_cert_file 的路径

php -r "print_r(openssl_get_cert_locations());"

2、下载证书

wget -P /etc/ssl/ http://curl.haxx.se/ca/cacert.pem
chmod 744 /etc/ssl/cacert.pem

注意:其中 /etc/ssl/cacert.pem 替换为自己的真实路径

CentOS 7 源码安装 CMake 3.17.0 最新稳定版。解决 cmake: command not found 问题。

1、准备编译环境

yum -y install gcc gcc-c++ openssl openssl-devel tar make

2、获取源码,并解压

wget https://github.com/Kitware/CMake/releases/download/v3.17.0/cmake-3.17.0.tar.gz
tar -zxf cmake-3.17.0.tar.gz
cd cmake-3.17.0

备用下载地址:https://down.24kplus.com/linux/cmake/cmake-3.17.0.tar.gz

3、编译安装

./bootstrap --prefix=/usr --datadir=share/cmake --docdir=doc/cmake && make
sudo make install

4、检查是否正确安装

cmake --version

cmake version 3.17.0

CMake suite maintained and supported by Kitware (kitware.com/cmake).

CentOS 7/8 安装 onigurumaoniguruma-devel 。解决 configure: error: Package requirements (oniguruma) were not met: Package 'oniguruma', required by 'virtual:world', not found 问题。

CentOS 7 安装

yum -y install http://mirror.centos.org/centos-7/7.7.1908/cloud/x86_64/openstack-queens/oniguruma-6.7.0-1.el7.x86_64.rpm
yum -y install http://mirror.centos.org/centos-7/7.7.1908/cloud/x86_64/openstack-queens/oniguruma-devel-6.7.0-1.el7.x86_64.rpm

备用下载:

oniguruma:http://down.24kplus.com/linux/oniguruma/oniguruma-6.7.0-1.el7.x86_64.rpm
oniguruma-devel:http://down.24kplus.com/linux/oniguruma/oniguruma-devel-6.7.0-1.el7.x86_64.rpm

CentOS 8 安装

yum config-manager --set-enabled PowerTools
yum -y install oniguruma oniguruma-devel

CentOS 7 源码安装 CMake 3.16.2 最新稳定版。解决 cmake: command not found 问题。

1、准备编译环境

yum -y install gcc gcc-c++ openssl openssl-devel tar

2、获取源码,并解压

wget https://github.com/Kitware/CMake/releases/download/v3.16.2/cmake-3.16.2.tar.gz
tar -zxf cmake-3.16.2.tar.gz
cd cmake-3.16.2

备用下载地址:https://down.24kplus.com/linux/cmake/cmake-3.16.2.tar.gz

3、编译安装

./bootstrap --prefix=/usr --datadir=share/cmake --docdir=doc/cmake && make
sudo make install

4、检查是否正确安装

cmake --version

cmake version 3.16.2

CMake suite maintained and supported by Kitware (kitware.com/cmake).

CentOS 7 源码安装 libmaxminddb 1.3.2 最新版。 libmaxminddb 是 ngx_http_geoip2_module 依赖项之一。

1、下载源码,并解压

wget https://github.com/maxmind/libmaxminddb/releases/download/1.3.2/libmaxminddb-1.3.2.tar.gz
tar -xvf libmaxminddb-1.3.2.tar.gz
cd libmaxminddb-1.3.2

备用下载地址:https://down.24kplus.com/linux/libmaxminddb-1.3.2.tar.gz

2、编译安装

./configure --prefix=/usr
make
sudo make install
sudo ldconfig

yum 源里最新的 gcc 版本是 4.8.5,但很多时候安装软件依赖于更高版本的 gcc,这时候只能通过手动源码安装最新版。

使用源码编译安装gcc耗时非常大,请要有耐心等待,耐心等待,耐心等待,重要的事情说三遍。

如果你觉得步麻烦可以使用 gcc一键安装 帮你完成!

1、下载并解压源码

wget https://ftp.gnu.org/gnu/gcc/gcc-9.2.0/gcc-9.2.0.tar.gz
tar -zxf gcc-9.2.0.tar.gz
cd gcc-9.2.0

备用下载地址:https://down.24kplus.com/linux/gcc-9.2.0.tar.gz

2、编译安装

下载必要软件包

./contrib/download_prerequisites

如果提示 tar (child): lbzip2: Cannot exec: No such file or directory 错误:

yum -y install bzip2

编译安装gcc

./configure --prefix=/usr \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--enable-bootstrap \
--enable-shared \
--enable-threads=posix \
--enable-checking=release \
--with-system-zlib \
--enable-__cxa_atexit \
--disable-libunwind-exceptions \
--enable-gnu-unique-object \
--enable-linker-build-id \
--with-linker-hash-style=gnu \
--enable-languages=c,c++ \
--enable-plugin \
--enable-initfini-array \
--disable-libgcj \
--enable-gnu-indirect-function \
--with-tune=generic \
--with-arch_32=x86-64 \
--build=x86_64-redhat-linux \
--disable-multilib
make
make install

如果出现 configure: error: GNAT is required to build ada 错误

yum -y install gcc-gnat -y

如果出现 fatal error: zlib.h: No such file or directory 错误

yum install zlib-devel -y

如果出现 configure: error: C++ preprocessor "/lib/cpp" fails sanity check 错误

yum install gcc-c++ -y

如果出现 makeinfo: command not found 错误

yum install texinfo -y

为了避免日后编译软件发生 checking for C compiler … not found 错误,执行:

ln -s /usr/bin/gcc /usr/bin/cc

4、检查是否正确安装

gcc -v

CentOS 7 源码安装 libzip 1.5.2,解决 error: Please reinstall the libzip distributioerror: system libzip must be upgraded to version >= 0.11 错误。

1、准备编译环境

yum install openssl-devel bzip2 bzip2-devel

2、下载源码,并解压

wget https://libzip.org/download/libzip-1.5.2.tar.gz
tar -zxf libzip-1.5.2.tar.gz
cd libzip-1.5.2

备用下载地址:https://down.24kplus.com/linux/libzip-1.5.2.tar.gz

3、编译安装

mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=/usr .. && make
sudo make install

如果提示 cmake: command not found,需要先安装 cmake

CentOS 7 源码安装 CMake 3.15.5 最新稳定版。解决 cmake: command not found 问题。

1、准备编译环境

yum -y install gcc gcc-c++

2、获取源码,并解压

wget https://github.com/Kitware/CMake/releases/download/v3.15.5/cmake-3.15.5.tar.gz
tar -zxf cmake-3.15.5.tar.gz
cd cmake-3.15.5

备用下载地址:https://down.24kplus.com/linux/cmake/cmake-3.15.5.tar.gz

3、编译安装

./bootstrap --prefix=/usr --datadir=share/cmake --docdir=doc/cmake && make
sudo make install

4、检查是否正确安装

cmake --version

cmake version 3.15.5

CMake suite maintained and supported by Kitware (kitware.com/cmake).