linux下php gd 库的安装步骤

发布时间:2020-02-03编辑:脚本学堂
本文介绍下,在linux系统中安装php gd库扩展的方法,分享下php gd库的安装步骤,有需要的朋友参考下。

一,先安装支持包(注意安装顺序)

1、安装zlib
 

复制代码 代码示例:
tar xzvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure
make
make install

2、安装freetype
 

复制代码 代码示例:
tar xzvf freetype-2.2.1.tar.gz
cd freetype-2.2.1
./configure
make
make install

3、安装libpng
 

复制代码 代码示例:
tar xzvf libpng-1.2.12.tar.gz
cd libpng-1.2.12
cp scripts/makefile.std makefile
make test
make install

4、安装jpeg
建立文件包:/usr/local/man/man1
 

复制代码 代码示例:
tar xzvf jpegsrc.v6b.tar.gz
./configure --enable-shared --enable-static
make
make install

注意,如果安装PHP5,必需安装libxml2

5、安装GD库
 

复制代码 代码示例:
tar xzvf gd-2.0.18.tar.gz
./configure --with-jpeg --with-png --with-zlib --with-freetype
make
make install

二,更改apache的配置文件:
让apache能解释php程序。
1,查找AddType application/x-tar .tgz 行,在下面添加:
 

复制代码 代码示例:
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php-source .phps

2,找到下面一行在后面添加:index.php,表示网站的默认页也允许为index.php
 

复制代码 代码示例:
DirectoryIndex index.html index.html.var index.php