如何让 MCrypt 和 PHP 在 CentOS 上协同工作
我已经在 CentOS 上安装了 mcrypt (通过 yum ),但是当我尝试在 A) 中执行 dl() 调用时,我在 B) 中收到消息。
- A) dl( mcrypt.so ) 或 die('Mcrypt 无法加载模块 ['. $前缀。 “mcrypt”。 。 PHP_SHLIB_SUFFIX .']');
- B) 的 无法加载 Mcrypt 模块 [ mcrypt.so ]
现在,我知道 yum 已经安装了 mcrypt,但我不知道它把它放在哪里。我能找到吗?更重要的是,如何让最新安装的 mcrypt 与我的 PHP 系统一起使用。许多线程建议您重新编译 PHP ( 例如: http://forums.theplanet.com/index .php?showtopic=26527 ),但我不知道如何使用 CentOS 执行此操作。我也尝试过我的库路径,但无济于事。任何帮助将不胜感激。
设置
- CentOS: Linux localhost.localdomain 2.6.18-128.1.6.el5 #1 SMP 4 月 1 日星期三 09:10:25 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
- mcrypt: mcrypt-2.6.8-1.el5.x86_64
- PHP: php-5.1.6-23.2.el5_3.x86_64
谢谢
蒂姆
I've installed mcrypt on CentOS ( via yum ), but when I try to do a dl() call in A), I get the message in B).
- A) dl( mcrypt.so ) or die('The Mcrypt
module could not be loaded ['.
$prefix . 'mcrypt.' .
PHP_SHLIB_SUFFIX .']'); - B) The
Mcrypt module could not be loaded [
mcrypt.so ]
Now, I know that yum has installed mcrypt, but I don't know the location it has put it in. Can I find that out? More importantly, how can I get the latest installed mcrypt working with my PHP system. Many threads suggest you recompile PHP ( ex: http://forums.theplanet.com/index.php?showtopic=26527 ), but I don't know how to do this with CentOS. I've also played with my library paths to no avail. Any help would be greatly appreciated.
Setup
- CentOS: Linux localhost.localdomain
2.6.18-128.1.6.el5 #1 SMP Wed Apr 1 09:10:25 EDT 2009 x86_64 x86_64
x86_64 GNU/Linux - mcrypt: mcrypt-2.6.8-1.el5.x86_64
- PHP: php-5.1.6-23.2.el5_3.x86_64
Thanks
Tim
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
以 root 或超级用户身份登录服务器并添加以下命令
参考 在 Centos 5.6 上安装 PHP 5.3 mcrypt 扩展
Login as a root or Super User to the server and add the below commands
Reference Install PHP 5.3 mcrypt extension on Centos 5.6
好吧,我假设有一些特殊原因您无法使用 CentOS 发行商提供的软件包(请参阅 此处。)我不了解 CentOS,但我可以为您提供最有可能成功构建和安装 PHP 的 mcrypt 模块的步骤的粗略路线图。
获取与您的发行版的编译版本相匹配的 PHP 源代码的副本(CentOS 可能有一个用于此目的的软件包)
获取
安装 PHP 开发包(可能类似于“php5-dev”)以及为您的发行版构建 PHP 的所有依赖项(在基于 Debian 的系统上,这是通过 apt-get build-dep 完成的) php5,不确定 CentOS 的正确拼写)。
从 PHP 源代码的顶级目录,cd 到
ext/mcrypt
。在此目录中,运行phpize
(这应该与上述 CentOS 上的php5-dev
等价物一起安装)。这将在 ext/mcrypt 中生成一个配置脚本,允许您将 mcrypt 构建为共享模块。从同一个
ext/mcrypt
目录中,发出./configure --help
并查看可用的选项。 开始,它与任何其他 Unix 应用程序非常相似:configure
、make
、make install
。Well, I'm going to assume there's some particular reason you can't use the package provided by the CentOS distributors (see here, for one example.) I don't know CentOS, but I can give you a rough roadmap of the steps that would most likely lead to a successful build and install of the mcrypt module for PHP.
Get a copy of the PHP source that matches your distro's compiled version (CentOS may have a package for this)
Install the PHP development pacakges (probably something like "php5-dev") as well as all dependencies to build PHP for your distro (on Debian-based systems, this is done via
apt-get build-dep php5
, not sure the correct incantation for CentOS).From the top level directory of the PHP source, cd into
ext/mcrypt
. In this directory, runphpize
(this should have been installed alongside the afore-mentioned CentOS equivalent ofphp5-dev
). This will generate a configure script inext/mcrypt
that will allow you to build mcrypt as a shared module.From the same
ext/mcrypt
directory, issue./configure --help
and look at the options available to you. From this point on, it's pretty much like any other Unix app:configure
,make
,make install
.