在 Linux 上安装 GD 库和 freetype

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21216129/
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-07 01:52:24  来源:igfitidea点击:

Install GD library and freetype on Linux

phplinuxubuntugdfreetype

提问by C A Mc

I'm trying to use imagefttext. And I need to have GD library and/or freetype installed. I'm new to this kind of stuffs, How can I install GD library and freetype in Linux ?

我正在尝试使用 imagefttext。我需要安装 GD 库和/或 freetype。我是这种东西的新手,如何在 Linux 中安装 GD 库和 freetype?

回答by Alireza Fallah

Installing GD :

安装GD:

For CentOS / RedHat / Fedora:

对于CentOS / RedHat / Fedora

sudo yum install php-gd

For Debian/ubuntu:

对于Debian/ubuntu

sudo apt-get install php5-gd

Installing freetype :

安装 freetype :

For CentOS / RedHat / Fedora:

对于CentOS / RedHat / Fedora

sudo yum install freetype*

For Debian/ubuntu:

对于Debian/ubuntu

sudo apt-get install freetype*


Don't forget to restart apache after that (if you are using apache):

之后不要忘记重新启动 apache(如果您使用的是 apache):

CentOS / RedHat / Fedora:

CentOS / RedHat / Fedora

sudo /etc/init.d/httpd restart

Or

或者

sudo service httpd restart

Debian/ubuntu:

Debian/Ubuntu

sudo /etc/init.d/apache2 restart

Or

或者

sudo service apache2 restart

回答by XIMRX

Things are pretty much simpler unless they are made confusing.

事情要简单得多,除非它们令人困惑。

To Install GD library in Ubuntu

在 Ubuntu 中安装 GD 库

sudo apt-get install php5-gd

To Install Freetype in Ubuntu

在 Ubuntu 中安装 Freetype

sudo apt-get install libfreetype6-dev:i386

回答by Mithun Billara

For CentOS:When installing php-gd you need to specify the version. I fixed it by running: sudo yum install php55-gd

对于 CentOS:安装 php-gd 时需要指定版本。我通过运行修复它: sudo yum install php55-gd

回答by IMAN4K

Installing freetype:

安装 freetype:

sudo apt update && sudo apt install freetype2-demos

sudo apt update && sudo apt install freetype2-demos