背景
- 在 centos8 上,通过源码安装 PHP8.3;使用 MySQL 数据库,运行 Laravel 应用。之前安装时,遗留php无法连接MySQL问题。
- 之前网站运行在ubuntu上,升级前没有备份数据库。后来,升级失败,导致数据库无法启动。目前,只有
/var/lib/mysql/database_name/*.idb文件。尝试通过.idb文件恢复数据库。
环境
系统:centos8 4核 8G内存
PHP编译
安装依赖过程中可能会出现的错误
No match for argument: db4-devel
No match for argument: aspell-devel
No match for argument: pspell-devel
Error: Unable to find a match: db4-devel aspell-devel pspell-devel
oniguruma
yum install autoconf
yum install automake
yum install libtool
libzip
configure: error: ZLIB version too old, please install at least v1.1.2
yum install zlib-devel
php
Package 'libxml-2.0', required by 'virtual:world', not found
yum install libxml2-devel
Package 'krb5-gssapi', required by 'virtual:world', not found Package 'krb5', required by 'virtual:world', not found
yum -y install krb5-devel
Package 'openssl', required by 'virtual:world', not found
yum -y install openssl-devel
Package 'sqlite3', required by 'virtual:world', not found
yum install sqlite-devel
configure: error: Please reinstall the BZip2 distribution
yum install libzip
yum install libzip-devel
checking for BZip2 in default path... not found
yum install bzip2-devel
Package 'libcurl', required by 'virtual:world', not found Package 'libpng', required by 'virtual:world', not found Package 'libjpeg', required by 'virtual:world', not found
yum install libcurl-devel
yum install libpng-devel
yum install libjpeg-devel
Package 'freetype2', required by 'virtual:world', not found configure: error: GNU MP Library version 4.2 or greater required.
yum install freetype-devel
yum install gmp-devel
Package 'icu-uc', required by 'virtual:world', not found Package 'icu-io', required by 'virtual:world', not found Package 'icu-i18n', required by 'virtual:world', not found
yum install libicu-devel
configure: error: in
/root/tmp/php-8.3.1': configure: error: C++ preprocessor "/lib/cpp" fails sanity check Seeconfig.log' for more details
yum -y install gcc
yum -y install gcc-c++
configure: error: Could not find net-snmp-config binary. Please check your net-snmp installation.
yum install net-snmp-devel
configure: error: Package requirements (libxslt >= 1.1.0) were not met: Package 'libxslt', required by 'virtual:world', not found
yum install libxslt-devel
make报错
/usr/bin/ld: dynamic STT_GNU_IFUNC symbol
mb_utf16be_to_wchar' with pointer equality inext/mbstring/libmbfl/filters/mbfilter_utf16.o' can not be used when making an executable; recompile with -fPIE and relink with -pie
根据报错信息可知,该错误是由 mbstring 插件产生。配置时关闭相关功能--enable-mbstring 编译通过。
禁用后,会导致用户注册报错。
逃避解决不了问题
直面问题虽然开始时会比较棘手,最终还是会解决!该问题原因是,centos库中binutils版本过所导致,下载源码,编译安装,该问题解决。
验证
php artisan migrate可以正常使用,数据库中正常创建数据表。