简体   繁体   English

CentOS:在 PHP 安装中启用 GD 支持

[英]CentOS: Enabling GD Support in PHP Installation

我如何在 CentOS 安装中启用 GD 支持?

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
  1. You need to find a repo that offers a GD lib matching your current php version.您需要找到一个提供与您当前 php 版本匹配的 GD 库的存储库。 I've had great success using Remi Collet's repo for this purpose.为此,我使用Remi Collet 的 repo取得了巨大的成功。 In fact, I used it yesterday to update my php install to the latest 5.4.0RC6 version on my CentOS6 box.事实上,我昨天使用它在我的 CentOS6 机器上将我的 php 安装更新到最新的 5.4.0RC6 版本。
  2. Once you've setup the repo it's a simple matter of running sudo yum install php-gd一旦你设置了 repo,运行sudo yum install php-gd简单了
  3. Of course, the usual things apply: make sure you restart apache after installing, etc.当然,通常的事情适用:确保在安装后重新启动apache等。

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.如果您收到如下错误: cannot map zero-fill pages: Cannot allocate memory in Unknown on line 0 ,这可能是因为您没有交换文件。 I suggest you take a look at the tutorial mentioned in this answer: https://stackoverflow.com/a/20275282/828366我建议你看看这个答案中提到的教程: 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

CentOs 6.5+ & PHP 5.6: CentOs 6.5+ 和 PHP 5.6:

sudo yum install php56-gd

service httpd restart

Put the command把命令

yum install php-gd

and restart the server (httpd, nginx, etc)并重新启动服务器(httpd、nginx 等)

service httpd restart

对于 CentOS 或 EC2 Linux AMI 上的 PHP7:

sudo yum install php70-gd

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM