在 CentOS 上安装 PHP 模块

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28173065/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 23:43:19  来源:igfitidea点击:

Install PHP modules on CentOS

phpmodulecentosphp-5.5centos7

提问by Maxime

I'm trying to install PHP 5.5.21 on CentOS 7.0. When I execute php -vI get about 10 modules errors like this one:

我正在尝试在 CentOS 7.0 上安装 PHP 5.5.21。当我执行时,php -v我会收到大约 10 个模块错误,如下所示:

PHP Warning:  PHP Startup: curl: Unable to initialize module
Module compiled with module API=20100525
PHP    compiled with module API=20121212

I tryed to install or update package with pecl install curland pecl upgrade curlBut pecl always responds :

我tryed安装或更新包pecl install curlpecl upgrade curl但PECL总是响应:

No releases available for package "pecl.php.net/curl"

And yum install php-curlsays:

yum install php-curl说:

Package php-common-5.4.16-23.el7_0.3.x86_64 already installed and latest version
Nothing to do

How can I do to fix modules error?

我该如何修复模块错误?

回答by EM-Creations

Try running: find / -name curl.so

尝试运行: find / -name curl.so

Then copy the directory it finds curl.soin and create a symbolic link to it where the rest of your working .so files are stored:

然后复制它找到的目录curl.so并创建一个符号链接到它的其余工作 .so 文件存储的位置:

cd <where your working .so files are>
ln -s <where curl.so is> curl.so

Then edit your php.inifile and enable the extension:

然后编辑您的php.ini文件并启用扩展名:

extension=curl.so

Restart apache:

重启阿帕奇:

service httpd restart
service apache2 restart `#If the service is named apache2 rather than httpd`

This resolved my problem when I had a similar issue.

当我遇到类似问题时,这解决了我的问题。

回答by Maxime

I finally solved my problem removing the custom PHP installation and using this tutorialto install PHP 5.5

我终于解决了删除自定义 PHP 安装并使用本教程安装 PHP 5.5 的问题