如何在 Fedora Core 5 上安装 PHP5?

如何在 Fedora Core 5 上安装 PHP5?

我尝试在 FC5 上从源代码安装 PHP5,一切配置和编译都正常。但是当我尝试运行 php 时,我收到以下错误。

PHP Warning:  PHP Startup: mysql: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP    compiled with module API=20060613, debug=0, thread-safety=0
These options need to match in Unknown on line 0

PHP Warning:  PHP Startup: mysqli: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP    compiled with module API=20060613, debug=0, thread-safety=0
These options need to match in Unknown on line 0

PHP Warning:  PHP Startup: gd: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP    compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: ldap: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP    compiled with module API=20060613, debug=0, thread-safety=0
These options need to match in Unknown on line 0

PHP Warning:  PHP Startup: mysql: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP    compiled with module API=20060613, debug=0, thread-safety=0
These options need to match in Unknown on line 0

PHP Warning:  PHP Startup: mysqli: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP    compiled with module API=20060613, debug=0, thread-safety=0
These options need to match in Unknown on line 0

PHP Warning:  PHP Startup: PDO: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP    compiled with module API=20060613, debug=0, thread-safety=0
These options need to match in Unknown on line 0

PHP Warning:  PHP Startup: pdo_mysql: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP    compiled with module API=20060613, debug=0, thread-safety=0
These options need to match in Unknown on line 0

PHP Warning:  PHP Startup: pdo_sqlite: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP    compiled with module API=20060613, debug=0, thread-safety=0

我使用以下选项配置了 PHP:

./configure --with-mysql --with-gd --enable-modules=php5 -with-zlib --enable-pdo=shared --with-pdo-sqlite=shared --with-sqlite=shared

有人知道发生了什么吗?我知道是模块版本不正确,但我不知道如何纠正。

我怎样才能正确安装它?

答案1

  1. 如果可以的话,升级 Fedora 11。这是值得的。

  2. 如果由于某种原因您无法升级操作系统,请配置没有任何 mysql、gd 等支持的 PHP,看看是否可以使其工作。使用简单或脚本进行测试。

    如果可行,则升级 mysql,然后仅尝试使用 --with-mysql,不要同时添加其他库。如果可行,则升级 zlib 并添加 zlib 标志。如果某些升级(如 mysql)不起作用,则升级其他升级,稍后再处理 mysql。要让一切正常,需要一天以上的时间。我希望这是值得的。

  3. 如果可以接受,将该服务器的端口 80 转发至具有最新操作系统的服务器的端口 80。

答案2

您是否先删除了旧的 PHP RPM?看起来一些旧库仍然存在,而新的 PHP 二进制文件正在尝试访问它们。

我不太喜欢在基于 RPM 的发行版上从源代码构建软件包,除非构建最终生成我可以安装的 RPM。我的观点是,在这样的机器上进行非基于 RPM 的安装只会“弄脏”机器。

看起来像雷米·科莱特正在维护一些 php-5 和模块的相当新的 RPM(事实上,他几天前刚刚为一系列 Fedora Core 发行版构建了 PHP-5.3,但他在 6 处停止了!请参阅:http://blog.famillecollet.com/post/2009/06/30/PHP-5.3.0-Released)。

我会看看他的 RPM 是否能达到你的要求(http://rpms.famillecollet.com/fedora/5/或镜像)。如果您确实想从源代码编译(因为,也许,您想要一个比 Remi Collett 提供的更新的版本),我会从 Remi 的站点下载 SRPM,安装它们,修改 .specfiles 以引用较新的版本,然后使用他的 .specfiles 进行构建。(第一次可能不起作用,但您应该能够找出导致构建中断的更改,这将为您提供一些使用 RPM 的良好经验)。

您甚至可能会发现他的适用于 FC6 的 PHP-5.3 RPM 可以在 FC5 上正常安装。

我经常为软件构建 RPM 软件包,以便将其安装到多台基于 RPM 的机器(通常是 CentOS)上。从 RPM 安装新软件意味着我的“生产”机器保持干净,并且不需要安装编译器。这是我强烈推荐的策略。

答案3

为什么您仍在运行 Fedora Core 5?我建议切换到支持期限更长的版本,例如 CentOS 5(顺便说一下,它有现成的 php 5.1)。您正在运行 3 年前的 Fedora 版本,因此它已经过了 EOL 两年……

相关内容