Linux CentOS:在 PHP 安装中启用 GD 支持
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9024946/
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
CentOS: Enabling GD Support in PHP Installation
提问by Andre S
How do I go about enabling GD Support in a CentOS Installation?
我如何在 CentOS 安装中启用 GD 支持?
采纳答案by alfasin
The thing that did the trick for me eventually was:
最终对我有用的事情是:
yum install gd gd-devel php-gd
and then restart apache:
然后重启apache:
service httpd restart
回答by rdlowrey
- You need to find a repo that offers a GD lib matching your current php version. I've had great success using Remi Collet's repofor this purpose. In fact, I used it yesterday to update my php install to the latest 5.4.0RC6 version on my CentOS6 box.
- Once you've setup the repo it's a simple matter of running
sudo yum install php-gd
- Of course, the usual things apply: make sure you restart apache after installing, etc.
- 您需要找到一个提供与您当前 php 版本匹配的 GD 库的存储库。为此,我使用Remi Collet 的 repo取得了巨大的成功。事实上,我昨天使用它在我的 CentOS6 机器上将我的 php 安装更新到最新的 5.4.0RC6 版本。
- 一旦你设置了 repo,它就是一个简单的运行问题
sudo yum install php-gd
- 当然,通常的事情适用:确保在安装后重新启动apache等。
回答by Francesco Casula
With CentOS 6.5+ and PHP 5.5:
使用 CentOS 6.5+ 和 PHP 5.5:
yum install php55u-gd
service httpd restart
If you get an error like: cannot map zero-fill pages: Cannot allocate memory in Unknown on line 0
, it could be because you don't have a swap file. I suggest you take a look at the tutorial mentioned in this answer: https://stackoverflow.com/a/20275282/828366
如果您收到如下错误:cannot map zero-fill pages: Cannot allocate memory in Unknown on line 0
,可能是因为您没有交换文件。我建议你看看这个答案中提到的教程:https: //stackoverflow.com/a/20275282/828366
Tutorial: https://www.digitalocean.com/community/articles/how-to-add-swap-on-centos-6
教程:https: //www.digitalocean.com/community/articles/how-to-add-swap-on-centos-6
回答by Burak Keskin
CentOs 6.5+ & PHP 5.6:
CentOs 6.5+ 和 PHP 5.6:
sudo yum install php56-gd
service httpd restart
回答by Ivan Fretes
Put the command
把命令
yum install php-gd
and restart the server (httpd, nginx, etc)
并重新启动服务器(httpd、nginx 等)
service httpd restart
回答by Adam Winter
For PHP7 on CentOS or EC2 Linux AMI:
对于 CentOS 或 EC2 Linux AMI 上的 PHP7:
sudo yum install php70-gd