PHP编译过程常见错误&解决方法

本文详细记录了解决在Ubuntu23.04环境下安装和配置PHP7.4.33时遇到的各种问题,包括依赖包安装、错误提示和SQLServer、Oracle等数据库连接设置,以及在Docker中的PHP扩展安装方法。
摘要由CSDN通过智能技术生成

环境

  • Ubuntu 23.04 x86_64
  • php7.4.33

查看ubuntu版本

   lsb_release -a

查看php版本

   php -v

查看php扩展

   php -m

错误提示&解决方法

xml2-config not found. Please check your libxml2 installation.

sudo apt-get install libxml2-dev

Cannot find OpenSSL’s <evp.h>

sudo apt-get install libcurl4-openssl-dev

Please reinstall the BZip2 distribution

sudo apt-get install libbz2-dev

Cannot find enchant

sudo apt-get install libenchant-dev

png.h not found.

sudo apt-get install libpng12-dev

Unable to locate gmp.h

sudo apt-get install libgmp-dev

utf8_mime2text() has new signature, but U8T_CANONICAL is missing

sudo apt-get install libc-client2007e-dev

libgds, libib_util or libfbclient not found!

sudo apt-get install firebird2.5-dev

Unable to detect ICU prefix or no failed

sudo apt-get install libicu-dev

cannot find ldap libraries in /usr/lib

sudo apt-get install libldap2-dev
sudo ln -fs /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/

mcrypt.h not found. Please reinstall libmcrypt.

sudo apt-get install libmcrypt-dev

Cannot find FreeTDS in known installation directories

sudo apt-get install freetds-dev

Could not find /usr/lib/libsybdb.a|so

sudo ln -fs /usr/lib/x86_64-linux-gnu/libsybdb.so /usr/lib/

运行程序查询sqlserver数据中文乱码解决

whereis freetds.conf
我的配置在 /etc/freetds
vi /etc/freetds/freetds.conf
然后在global下添加:
	client  charset = utf8

Oracle Instant Client directory /usr/lib/oracle/…/client64/lib libraries not found

安装oracle扩展
禁用oracle扩展 –without-oci8 –without-pdo_oci
cannot stat ‘/usr/local/lib/odbclib.a’: No such file or directory

sudo apt-get install unixodbc-dev
sudo ln -fs /usr/lib/x86_64-linux-gnu/libodbc.a /usr/local/lib/odbclib.a

ODBC header file ‘/usr/local/incl/sqlext.h’ not found!

sudo apt-get install unixodbc-dev
sudo mkdir /usr/local/incl
sudo cp /usr/include/sqlext.h /usr/local/incl/

Cannot find pspell

sudo apt-get install libpspell-dev

Please reinstall libedit - I cannot find readline

sudo apt-get install libedit-dev

Can not find recode.h anywhere under yes /usr/local /usr /opt

sudo apt-get install librecode-dev

Cannot find libtidy

sudo apt-get install libtidy-dev

xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution

sudo apt-get install libxslt1-dev

ctpublic.h missing!

sudo apt-get install freetds-dev 
--with-sybase-ct=shared,/usr

docker中安装php扩展

docker exec -it php7.4 bash

docker-php-ext-install pdo_mysql

apt update

apt install -y libwebp-dev libjpeg-dev libpng-dev libfreetype6-dev
cd /usr/src/
tar -xf php.tar.xz

安gd库(后面参数可能会报错,去掉也能安装)
cd /usr/src/php-7.4.33/ext/gd
docker-php-ext-configure gd --with-webp-dir=/usr/include/webp --with-jpeg-dir=/usr/include --with-png-dir=/usr/include
docker-php-ext-install gd

安装 pdo_dblib
cd /usr/src/php-7.4.33/ext/pdo_dblib
docker-php-ext-configure  pdo_dblib
docker-php-ext-install  pdo_dblib

ctrl +q +p 
docker restart php7.4
  • 9
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值