如何让 MCrypt 和 PHP 在 CentOS 上协同工作

发布于 2024-08-03 15:15:40 字数 869 浏览 9 评论 0原文

我已经在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

汐鸠 2024-08-10 15:15:41

以 root 或超级用户身份登录服务器并添加以下命令


yum install php53-devel
yum install libmcrypt-devel
yum install gcc
wget http://museum.php.net/php5/php-5.3.3.tar.bz2
tar xvjf php-5.3.3.tar.bz2
cd php-5.3.3/ext/mcrypt/
phpize
aclocal
./configure
make
make install
echo "extension=mcrypt.so" > /etc/php.d/mcrypt.ini
service httpd restart

参考 在 Centos 5.6 上安装 PHP 5.3 mcrypt 扩展

Login as a root or Super User to the server and add the below commands


yum install php53-devel
yum install libmcrypt-devel
yum install gcc
wget http://museum.php.net/php5/php-5.3.3.tar.bz2
tar xvjf php-5.3.3.tar.bz2
cd php-5.3.3/ext/mcrypt/
phpize
aclocal
./configure
make
make install
echo "extension=mcrypt.so" > /etc/php.d/mcrypt.ini
service httpd restart

Reference Install PHP 5.3 mcrypt extension on Centos 5.6

我一向站在原地 2024-08-10 15:15:41

好吧,我假设有一些特殊原因您无法使用 CentOS 发行商提供的软件包(请参阅 此处。)我不了解 CentOS,但我可以为您提供最有可能成功构建和安装 PHP 的 mcrypt 模块的步骤的粗略路线图。

  1. 获取与您的发行版的编译版本相匹配的 PHP 源代码的副本(CentOS 可能有一个用于此目的的软件包)

    获取

  2. 安装 PHP 开发包(可能类似于“php5-dev”)以及为您的发行版构建 PHP 的所有依赖项(在基于 Debian 的系统上,这是通过 apt-get build-dep 完成的) php5,不确定 CentOS 的正确拼写)。

  3. 从 PHP 源代码的顶级目录,cd 到 ext/mcrypt。在此目录中,运行 phpize (这应该与上述 CentOS 上的 php5-dev 等价物一起安装)。这将在 ext/mcrypt 中生成一个配置脚本,允许您将 mcrypt 构建为共享模块。

  4. 从同一个 ext/mcrypt 目录中,发出 ./configure --help 并查看可用的选项。 开始,它与任何其他 Unix 应用程序非常相似:configuremakemake 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.

  1. Get a copy of the PHP source that matches your distro's compiled version (CentOS may have a package for this)

  2. 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).

  3. From the top level directory of the PHP source, cd into ext/mcrypt. In this directory, run phpize (this should have been installed alongside the afore-mentioned CentOS equivalent of php5-dev). This will generate a configure script in ext/mcrypt that will allow you to build mcrypt as a shared module.

  4. 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文