升级PHP 7.4 遇到的各种问题及解决办法

89 阅读技术资料PHP7.4
0

第一个问题:

error: Package requirements (sqlite3 > 3.7.4) were not met
 error: Package requirements (sqlite3 > 3.7.4) were not met
No package 'sqlite3' found


若看到上面的报错,非常简单:

yum install libsqlite3x-devel -y

以上如果还不能解决问题,可以手动升级:

1.下载源码
 wget https://www.sqlite.org/2019/sqlite-autoconf-3300100.tar.gz
2.解压,编译
 tar zxvf sqlite-autoconf-3290000.tar.gz 
cd sqlite-autoconf-3290000/
./configure --prefix=/usr/local
make && make install
3.替换系统低版本sqlite3
 mv /usr/bin/sqlite3  /usr/bin/sqlite3_old
ln -s /usr/local/bin/sqlite3   /usr/bin/sqlite3
echo "/usr/local/lib" > /etc/ld.so.conf.d/sqlite3.conf
ldconfig
sqlite3 -version

第二个问题:

error: Package requirements (oniguruma) were not met
 error: Package requirements (oniguruma) were not met
No package 'oniguruma' found


若看到上面的报错,非常简单:

yum install oniguruma-devel -y


第三:其它可能出现的错误留作备查
No package ‘libxml-2.0’ found

<code>configure: error: Package requirements (libxml-2.0 >= 2.7.6) were not met:

No package 'libxml-2.0' found
</code>

解决方法

<code>yum <span class="token function">install</span> libxml2-devel
</code>

中途可能需要更新其他的依赖, 确定就可以了
No package ‘openssl’ found

<code>configure: error: Package requirements (openssl >= 1.0.1) were not met:

No package 'openssl' found
</code>

解决方法

<code>yum <span class="token function">install</span> openssl-devel
</code>

No package ‘sqlite3’ found

<code>configure: error: Package requirements (sqlite3 > 3.7.4) were not met:

No package 'sqlite3' found
</code>

解决方法

<code>yum <span class="token function">install</span> sqlite-devel
</code>

No package ‘libcurl’ found

<code>configure: error: Package requirements (libcurl >= 7.15.5) were not met:

No package 'libcurl' found
</code>

解决方法

<code>yum <span class="token function">install</span> libcurl-devel
</code>

Package requirements (icu-uc >= 50.1 icu-io icu-i18n) were not met

<code>configure: error: Package requirements (icu-uc >= 50.1 icu-io icu-i18n) were not met:

No package 'icu-uc' found
No package 'icu-io' found
No package 'icu-i18n' found
</code>

解决方法

<code>yum <span class="token function">install</span> libicu-devel
</code>

configure: error: C++ preprocessor “/lib/cpp” fails sanity check

<code>checking whether g++ accepts -g... no
checking how to run the C++ preprocessor... /lib/cpp
configure: error: in `/data/programs/php-7.4.7':
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details
</code>

解决方法, 缺少g++库, 安装

<code>yum <span class="token function">install</span> gcc-c++
</code>

No package ‘oniguruma’ found

<code>configure: error: Package requirements (oniguruma) were not met:

No package 'oniguruma' found
</code>

如果启用了--with-mbstring,则需要安装 oniguruma, 因为7.4的正则表达式使用了oniguruma

解决方法

<code>yum <span class="token function">install</span> oniguruma oniguruma-devel
</code>

No package ‘libxslt’ found

<code>configure: error: Package requirements (libxslt >= 1.1.0) were not met:

No package 'libxslt' found
</code>

--with-xsl 打开XSLT 文件支持,扩展了libXML2库 ,需要libxslt软件

解决方法

<code>yum <span class="token function">install</span> libxslt-devel
</code>

No package ‘libpng’ found

<code>configure: error: Package requirements (libpng) were not met:

No package 'libpng' found
</code>

解决方法

<code>yum <span class="token function">install</span> libpng-devel
</code>

No package ‘libjpeg’ found

<code>configure: error: Package requirements (libjpeg) were not met:

No package 'libjpeg' found
</code>

解决方法

<code>yum <span class="token function">install</span> libjpeg-devel
</code>

No package ‘freetype2’ found

<code>configure: error: Package requirements (freetype2) were not met:

No package 'freetype2' found
</code>

解决方法

<code>yum <span class="token function">install</span> freetype-devel
</code>

No package ‘libzip’ found

<code>configure: error: Package requirements (libzip >= 0.11) were not met:

No package 'libzip' found
</code>

解决方法

<code>这里不使用软件仓库中的libzip, 也就是不使用yum <span class="token function">install</span> libzip-devel,
因为版本不够, 安装方法看下面一条
</code>

Requested ‘libzip >= 0.11’ but version of libzip is 0.10.1
这是因为软件仓库的libzip版本过低, 需要手动编译安装

<code><span class="token comment" spellcheck="true"># 先删除原有的libzip</span>
yum remove -y libzip
<span class="token comment" spellcheck="true"># 下载并手动编译安装, 自己下载到合适的位置</span>
<span class="token function">wget</span> https://nih.at/libzip/libzip-1.2.0.tar.gz
<span class="token comment" spellcheck="true"># 解压</span>
<span class="token function">tar</span> -zxvf libzip-1.2.0.tar.gz
<span class="token comment" spellcheck="true"># 进入到源码目录</span>
<span class="token function">cd</span> libzip-1.2.0
<span class="token comment" spellcheck="true"># 配置</span>
./configure
<span class="token comment" spellcheck="true"># 编译并安装</span>
<span class="token function">make</span> <span class="token operator">&&</span> <span class="token function">make</span> <span class="token function">install</span>
<span class="token comment" spellcheck="true"># 更新依赖路径, centos版本小于8的,一定要执行下面这个命令,不然还是找不到 libzip</span>
<span class="token function">export</span> PKG_CONFIG_PATH<span class="token operator">=</span><span class="token string">"/usr/local/lib/pkgconfig/"</span>
<span class="token comment" spellcheck="true"># 上面一行的代码参考自 https://wujie.me/centos7-3-compile-and-install-php-7-4-1/</span>
</code>

配置完成


分享到:
提问于

Login

Welcome! Login in to your account

Remember meLost your password?

Don't have account. Register

Lost Password

Register