gpt4 book ai didi

php - 无法将 PHP 查询发送到 MySQL

转载 作者:行者123 更新时间:2023-11-29 04:47:01 24 4
gpt4 key购买 nike

当我尝试将查询从 PHP 5.4.6 TS,VC9 发送到 MySQL 5.5 (NTS,VC9) 时,我收到消息:

 Fatal error: Call to undefined function mysql_connect()

在 (Windows xp) 上重新启动 Apache 2.2 后,它说:

PHP Startup: mysql: Unable to initialize module
Module compiled with build ID=API20100525,NTS,VC9
PHP compiled with build ID=API20100525,TS,VC9
These options needs to match

我该如何解决这个问题?

最佳答案

您可能安装了 PHP 5.4 而没有安装 mysql 支持包。在某些 Linux 发行版中,PHP mysql 扩展位于单独的包中。

例如,在我的 CentOS VM 上安装了这些软件包:

$ rpm -qa | grep php
php55w-common-5.5.0-1.w6.x86_64
php55w-pear-1.9.4-6.w6.noarch
php55w-cli-5.5.0-1.w6.x86_64
php55w-mysql55-5.5.0-1.w6.x86_64
php55w-5.5.0-1.w6.x86_64
php55w-pdo-5.5.0-1.w6.x86_64

至于如何解决这个错误,这取决于您使用的 Linux 发行版,以及您安装 PHP 的软件包存储库是什么。

PS:您根本不应该使用已弃用的 mysql_* 扩展,除非您需要支持遗留的 PHP 代码。使用 mysqliPDO .

关于php - 无法将 PHP 查询发送到 MySQL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17538749/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com