`
beyondhjjyt
  • 浏览: 37006 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

CentOS下编译安装PHP扩展库

 
阅读更多

上次编译安装PHP时没有选择安装curl扩展,下面记录一下安装PHP curl扩展的方法。


我的PHP安装目录:/usr/local/php;


我的PHP源代码存放位置:/localhost/php-5.4.13/;


Apache的安装目录:/usr/local/apache/ 。


进入php源代码的curl扩展目录:cd /localhost/php-5.4.13/ext/curl


调用phpize程序生成编译配置文件,/usr/local/php/bin/phpize


开始编译扩展库,./configure –with-php-config=/usr/local/php5bin/php-config


一般会出现错误如下:


checking for cURL in default path… not found
configure: error: Please reinstall the libcurl distribution -
easy.h should be in /include/curl/


解决方法:yum -y install curl-devel


然后再次输入:./configure –with-php-config=/usr/local/php5/bin/php-config


make成功执行后,生成的扩展库文件在当前目录的 modules 子目录下,如 /home/Downloads/php-5.2.6/ext/curl/modules/curl.so


将编译好的扩展库文件复制到apache2 modules目录下


cp /localhost/php-5.4.13/ext/curl/modules/curl.so /usr/local/apache/modules


在php.ini文件中找到设置扩展目录的位置,然后将扩展路径设置到apache modules目录下


extension_dir = “/usr/local/apache/modules/”


在php.ini的设置扩展库位置,设置要添加的扩展库。


extension=curl.so


以此类推,以后如果还要添加别的扩展库的话,则只需先将php扩展库编译好,然后copy到apache2 modules目录下,


然后再在这个位置,另取一行将编译后的扩展库文件名加上即可


最后重启apache,查看phpinfo信息,即可看到刚才添加进去的curl扩展库。



(1)安装mcrypt,(2)安装php对mcrypt的扩展,(3)重启apache

(1)、确认你的linux没有安装mcrypt库,如果已安装,跳过安装步骤

[root@test-206 ~]# yum list installed|grep mcrypt
libmcrypt.x86_64                          2.5.8-4.el5.centos           installed
libmcrypt-devel.x86_64                    2.5.8-4.el5.centos           installed
mcrypt.x86_64                             2.6.8-1.el5                  installed

以上显示已经安装过,若没有,则按以下两种方式安装

(方法一)yum命令懒人安装

yum install libmcrypt libmcrypt-devel mcrypt mhash

执行后会显示即将安装的相关库,你可以根据你的linux限定x86_64或者i386,如yum install libmcrypt.x86_64(如果yum命令无法连接仓库,请检查你的/etc/yum.repos.d/里的文件正确性,以及你的/etc/host是不是可达里面的域名)

复制代码
Dependencies Resolved

================================================================================
 Package              Arch        Version                   Repository     Size
================================================================================
Installing:
 libmcrypt            i386        2.5.7-5.el5               epel          124 k
 libmcrypt            x86_64      2.5.8-4.el5.centos        extras        105 k
 libmcrypt-devel      i386        2.5.7-5.el5               epel          103 k
 libmcrypt-devel      x86_64      2.5.8-4.el5.centos        extras         10 k
 mcrypt               x86_64      2.6.8-1.el5               epel           88 k
 mhash                i386        0.9.2-6.el5               epel          141 k
 mhash                x86_64      0.9.9-1.el5.rf            rpmforge      161 k

Transaction Summary
================================================================================
Install       7 Package(s)
Upgrade       0 Package(s)

Total download size: 731 k
Is this ok [y/N]:
复制代码

确定安装,最后显示

复制代码
Installed:
  libmcrypt.x86_64 0:2.5.8-4.el5.centos
  libmcrypt-devel.x86_64 0:2.5.8-4.el5.centos
  mcrypt.x86_64 0:2.6.8-1.el5
  mhash.x86_64 0:0.9.9-1.el5.rf

Complete!
复制代码

(方法二)源码编译安装,去http://www.sourceforge.net下载Libmcrypt,mhash,mcrypt安装包
libmcrypt(libmcrypt-2.5.8.tar.gz ):
mcrypt(mcrypt-2.6.8.tar.gz ):
mhash(mhash-0.9.9.9.tar.gz ):
2 .先安装Libmcrypt

#tar -zxvf libmcrypt-2.5.8.tar.gz
#cd libmcrypt-2.5.8
#./configure
#make
#make install 说明:libmcript默认安装在/usr/local 


3.安装mhash

#tar -zxvf mhash-0.9.9.9.tar.gz
#cd mhash-0.9.9.9
#./configure
#make
#make install

4.安装mcrypt

#tar -zxvf mcrypt-2.6.8.tar.gz
#cd mcrypt-2.6.8
#LD_LIBRARY_PATH=/usr/local/lib ./configure
#make
#make install

最后,还是检查下,是否安装成功

(2)、安装php的mcrypt扩展(动态加载编译)

下载php下的mcrypt扩展或者直接下载php的完整安装包

http://cn.php.net/releases/网页下找到自己服务器的php版本,下载后tar解压(本人的是php5.3.3)

进入ext/mcrypt文件夹

[root@*_* 14:45 ~]# cd php-5.3.3/ext/mcrypt/

执行phpize命令(phpize是用来扩展php扩展模块的,通过phpize可以建立php的外挂模块,如果没有?yum install php53-devel里包含了,或者其他方法)

复制代码
[root@*_* 14:48 mcrypt]# whereis phpize    //为了确定phpize存在
phpize: /usr/bin/phpize /usr/share/man/man1/phpize.1.gz
[root@*_* 14:48 mcrypt]# phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
复制代码

执行完后,会发现当前目录下多了一些configure文件,最后执行php-config命令就基本完成了

执行以下命令,确保你的/usr/bin/php-config是存在的

[root@*_* 15:02 mcrypt]# whereis php-config
php-config: /usr/bin/php-config /usr/share/man/man1/php-config.1.gz
[root@*_* 15:02 mcrypt]# ./configure --with-php-config=/usr/bin/php-config

如果遇到以下错误,请先安装gcc,命令yum install gcc

configure: error: no acceptable C compiler found in $PATH

直到不报错,出现:config.status: creating config.h,执行以下命令

[root@*_* 15:06 mcrypt]# make && make install

最后的最后,会提示你如下,说明你大功告成了

Installing shared extensions:     /usr/lib64/php/modules/

顺便检查下/usr/lib64/php/modules/里的mrcypt.so扩展是否已经创建成功

然后的事就简单了,给你的php.ini添加一条extension=mcrypt.so

[root@*_* 15:09 mcrypt]# cd /etc/php.d

创建一个mrcypt.ini文件就行,里面写extension=mcrypt.so

[root@*_* 15:17 php.d]# echo 'extension=mcrypt.so' > mcrypt.ini

(3) 、重启apache,查阅phpinfo,mcrypt模块扩展是不是加载了?

今天给一台CentOS系统的服务器上传了一个新的程序之后,发现部分页面显示不出来,或者不完整。查看Apache的错误日志的时候发现了大量的PHP报错提示:

PHP Fatal error: Call to undefined function json_decode()

这是典型的PHP组件未安装出现的提示,错误信息就是找不到某个函数XXX。经查,这个函数是PHP的json扩展包含的。接下来就简单了,只需要安装好json扩展即可消除这个错误,从而使网页恢复正常。

首先尝试最简单的方法,输入yum指令进行安装:yum install php-json,结果提示没有这个扩展包;再次尝试输入yum install json也不行。于是输入yum search php-,列出所有的PHP扩展包进行查找。结果还是没有找到跟json有关的扩展包。

既然yum自己不带,那么就得拿出Linux下的杀手锏——编译了。网上搜索了下相关的文章并自己实战操作了下,发现其实编译个json也并不是很难的事情。于是整理心得如下:

1、切换到tmp目录下载json源码包。进行临时的下载操作进入到tmp目录是个很好的习惯,因为Linux系统在开机的时候会自动清空tmp目录,从而保持硬盘文件的整洁。当然如果你要保留这个源码包的话,可以下载到自己喜欢的目录。

#cd /tmp

#wget http://www.aurore.net/projects/php-json/php-json-ext-1.2.1.tar.bz2

2、解压缩下载得到的文件:

#tar xvjf php-json-ext-1.2.1.tar.bz2

3、进入源码目录:

#cd php-json-ext-1.2.1

4、准备编译环境。这一步可以先不做直接进行第5步操作,如果遇到问题后再进行本步检查也无所谓。不过为了避免不必要的麻烦,我们还是检查下编译环境是否准备好了吧!

#yum install php-devel automake autoconf libtool gcc

5、准备PHP模块的编译环境:

#phpize

6、开始编译json模块:

#./configure

#make

#make install

7、配置php.ini。首先打开php.ini文件:

#vim /etc/php.ini

注:这里我的php.ini是在/etc目录下,如果你的php.ini不在这里,请修改路径为你的php.ini所在的路径。

直接在最后一行加上下面这段话:

extension=json.so

然后输入:wq保存退出。

8、重启Apache服务

#/etc/init.d/httpd restart

成功重启之后,可以利用phpinfo()去查看是否有json的信息。我试着打开之前报错的页面,已经完全能正常打开了,一切OK。


一、安装服务端

1.下载MongoDB

http://www.mongodb.org/downloads

 我下载的是1.6的版本

2.解压并把解压包bin目录中的文件全部移到/usr/local/bin目录下面

3.运行mongo的服务器端程序

/usr/local/bin/mongod --port <端口> --bind_ip <本机IP> --dbpath <数据库文件存放的位置>

如果要求开机就启动就在

/usr/local/etc/rc.local中加入下面一行内容

usr/local/bin/mongod --port <端口> --bind_ip <本机IP> --dbpath <数据库文件存放的位置> >/dev/null &

4.测试安装是否成功

运行指令

#/usr/local/bin/mongo --port 4312 --host 127.0.0.1

显示

MongoDB shell version: 1.6.0

connecting to: 127.0.0.1:4312/test

>help
db.help() help on db methods
db.mycoll.help() help on collection methods
rs.help() help on replica set methods
help connect connecting to a db help
help admin administrative help
help misc misc things to know
show dbs show database names
show collections show collections in current database
show users show users in current database
show profile show most recent system.profile entries with time >= 1ms
use <db_name> set current database
db.foo.find() list objects in collection foo
db.foo.find( { a : 1 } ) list objects in foo where a == 1
it result of the last line evaluated; use to further iterate
exit quit the mongo shell
下面的自己慢慢玩了。
二、安装客户端

1.去http://pecl.php.net/package/mongo下载相关的扩展包

  另外在github上面也有不少相关的资源

  http://github.com/mongodb/mongo-php-driver/downloads

2.运行下面命令

pecl install

3.进入/etc/php.d

创建mongo.ini

添加下面的内容

extension=mongo.so

4.重启apache

5.写php脚本测试是否成功

#/usr/local/bin/mongo --port 4312 --host 127.0.0.1

>show dbs;

/*选择数据库*/

>use test;

/*查看Collection*/

>db.getCollectionNames() //显示结果["system.indexes", "system.users" ]

//创建一个新Collection
>db.createCollection('cartoons');
>exit;
把http://cn2.php.net/manual/en/mongo.tutorial.php最下方的程序复制在一个文件test.php中
记得改连接的主机和端口
我的改动为改
$m = new Mongo();

$m = new Mongo("127.0.0.1:4312");
然后在网页上面浏览或是用命令行执行即可看到相关的结果


Gettext
1 首先进入到php源码包中
cd /opt/php-5.1.2/ext/gettext
2 在gettext文件夹下产生configure文件
/opt/php/bin/phpize
3 配置编译
./configure --with-php-config=/opt/php/bin/php-config --with-gettext
make && make install
4 在/opt/php/lib/php/extensions下产生一个gettext.so文件
5 确定 php.ini文件中的extension_dir=/opt/php/lib/php/extensions 跟 extension=gettext.so
6 重新编译 php
Zlib
1 首先进入到php源码包中
cd /opt/php-5.1.2/ext/zlib
2 在zlib文件夹下产生configure文件
/opt/php/bin/phpize
3 配置编译
./configure --with-php-config=/opt/php/bin/php-config --with-zlib
make && make install
4 在/opt/php/lib/php/extensions下产生一个zlib.so文件
5 确定 php.ini文件中的extension_dir=/opt/php/lib/php/extensions 跟 extension=zlib.so
6 重新编译 php
mbString
配制mbstring扩展
1 运行 /opt/php/bin/phpize
2 进入到 php源码包中的ext/mbstring下
cd /opt/php-5.1.2/ext/mbstring
./configure --with-php-config=/opt/php/bin/php-config --enable-mbstring
make && make install
3 这样就在/opt/php/lib/php/extensions下生成一个mbstring.so
4然后保证extension_dir指向正确的位置,extension=php_mbstring.dll开启
这样mbstring就开启了
Mod_rewrite
以RHEL5为例
1)首次安装apache,在编译时增加--enable-rewrite选项。
如./configure --prefix=/usr/local/apachel --enable-so --enable-mods-shared=all --enable-rewrite --enable-cache
2)增加mod_rewrite模块
# find mod_rewrite.c //在apache的源码安装目录中寻找mod_rewrite.c文件
一般会在httpd-2.28/modules/mappers下
# /opt/httpd/bin/apxs -c mod_rewrite.c //apxs应指定绝对路径,在你当前正在使用apache的bin目录里
# /opt/httpd/bin/apxs -i -a -n mod_rewrite mod_rewrite.la
如果没有什么错误的话,应该在你的apache的modules目录中编译出一个mod_rewrite.so文件。
编辑httpd.conf文件,确认httpd.conf中已经包含mod_rewrite.so的加载语句,如下:
LoadModule rewrite_module modules/mod_rewrite.so
这时,你的apache应该已经支持rewrite了。
重启apache即可。

################
mysqli模块的安装
################


记得原来在编译php的已经已经加上参数
--with-mysql=/usr/local/mysql \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
可后来找了一个,的确不存在mysqli.so,所以只能单独来编译mysqli了。
mysqli是优化过的mysql函数库,MYSQL版本不能低于4.1.12
cd /root/lamp/php-5.2.3/ext/mysqli
#####进入到mysqli的目录。
再用phpize生成configure文件:
/usr/local/php/bin/phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
#./configure --prefix=/usr/local/mysqli \
--with-php-config=/usr/local/php/bin/php-config \
--with-mysqli=/usr/local/mysql/bin/mysql_config
make
make test
make install
Installing shared extensions: /usr/local/php/lib/php/extensions/debug-non-zts-20060613/
然后在/usr/local/lib/php.ini
加上一句:
extension=/usr/local/php/lib/php/extensions/debug-non-zts-20060613/mysqli.so
重新启动apache即可看到已经加载mysqli成功。
测试Mysqli运行状况:
Vim mysqli.php
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
printf("Host information: %s\n", $mysqli->host_info);
/* close connection */
$mysqli->close();

?>



系统版本是5.2,把安装memcached的方法记录下先:

复制代码代码如下:

cd ~/memcached
wget -c http://www.monkey.org/~provos/libevent-1.4.10-stable.tar.gz
wget -c http://memcached.googlecode.com/files/memcached-1.2.8.tar.gz
#安装libevent
tar -zxvf libevent-1.4.10-stable.tar.gz
cd libevent-1.4.10-stable
./configure
make
make install
#安装memcached
cd ..
tar -zxvf memcached-1.2.8.tar.gz
cd memcached-1.2.8
./configure
make
make install
#如果是64位系统,还需要把libevent的文件复制到/wp-content/lib64/下,用来解决error while loading shared libraries的问题
cp -R /wp-content/local/lib/libevent* /wp-content/lib64/


好了,开始安装php的扩展,恶梦开始了,本以为直接用yum来安装php-devel.x86_64和php-pecl-memcache.x86_64这两个扩展就可以了,可装了后 phpinfo()里根本找不到memcache扩展,把已经装的这两个扩展remove重来,还是不行,goooooooooooooogle,找到了一篇文章《PHP Pecl Memcached module installation problems》,有救喽,先remove掉php-pecl-memcache.x86_64,然后执行了

pecl install memcache

顺利安装上了,打开/etc/php.d/看了下,没有memcache.ini,好吧,手动到/etc/php.ini加上了 extension=memcache.so,好了,重启httpd,刷新 phpinfo() ,竟然还没有,我郁闷了。。

回头想想,我好像漏了一个地方没有检查,马上打开 /wp-content/lib64/php/modules/ 查看,果然没有memcache.so,会在哪呢? find -name之,原来躲在 /wp-content/local/lib/php/extensions/no-debug-non-zts-20060613/ 下,复制到 /wp-content/lib64/php/modules/ 再试,久违的 memcache扩展出现了。 T T

2009-04-24_180150

Memcached参数说明:

  • -d选项是启动一个守护进程
  • -m分配给Memcache使用的内存数量,单位是MB
  • -u运行Memcache的用户
  • -l监听的服务器IP地址
  • -p设置Memcache监听的端口,最好是1024以上的端口
  • -c最大运行的并发连接数,默认是1024,按照你服务器的负载量来设定
  • -P设置保存Memcache的pid文件

启动:

memcached -d -u root -m 128 -c 8192

查看状态:

watch “echo stats | nc 127.0.0.1 11211″


状态说明:

  • uptime:memcached运行的秒数
  • cmd_get:查询缓存的次数。这两个数据相除一下就能得到平均每秒请求缓存的次数
  • cmd_set:设置key=>value的次数
  • get_hits:缓存命中的次数。缓存命中率 = get_hits/cmd_get * 100%
  • scurr_items:现在在缓存中的键值对个数

相关网址:

Libevent:http://www.monkey.org/~provos/libevent/
Memcached:http://danga.com/memcached/
PHP Memcached Extension:http://pecl.php.net/package/memcache


[shell]
[root@~]# pecl install memcache
downloading memcache-2.2.6.tgz ...
Starting to download memcache-2.2.6.tgz (35,957 bytes)
..........done: 35,957 bytes
11 source files, building
WARNING: php_bin /opt/php/bin/php appears to have a suffix /bin/php, but config variable php_suffix does not match
running: phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
Enable memcache session handler support? [yes] : n
[/shell]

[shell]
running: make INSTALL_ROOT="/var/tmp/pear-build-root/install-memcache-2.2.6" install
Installing shared extensions: /var/tmp/pear-build-root/install-memcache-2.2.6/opt/php/lib/php/extensions/no-debug-non-zts-20090626/
running: find "/var/tmp/pear-build-root/install-memcache-2.2.6" | xargs ls -dils
11370548 4 drwxr-xr-x 3 root root 4096 Jan 6 15:55 /var/tmp/pear-build-root/install-memcache-2.2.6
11370602 4 drwxr-xr-x 3 root root 4096 Jan 6 15:55 /var/tmp/pear-build-root/install-memcache-2.2.6/opt
11370603 4 drwxr-xr-x 3 root root 4096 Jan 6 15:55 /var/tmp/pear-build-root/install-memcache-2.2.6/opt/php
11370604 4 drwxr-xr-x 3 root root 4096 Jan 6 15:55 /var/tmp/pear-build-root/install-memcache-2.2.6/opt/php/lib
11370605 4 drwxr-xr-x 3 root root 4096 Jan 6 15:55 /var/tmp/pear-build-root/install-memcache-2.2.6/opt/php/lib/php
11370606 4 drwxr-xr-x 3 root root 4096 Jan 6 15:55 /var/tmp/pear-build-root/install-memcache-2.2.6/opt/php/lib/php/extensions
11370607 4 drwxr-xr-x 2 root root 4096 Jan 6 15:55 /var/tmp/pear-build-root/install-memcache-2.2.6/opt/php/lib/php/extensions/no-debug-non-zts-20090626
11370601 236 -rwxr-xr-x 1 root root 235639 Jan 6 15:55 /var/tmp/pear-build-root/install-memcache-2.2.6/opt/php/lib/php/extensions/no-debug-non-zts-20090626/memcache.so

Build process completed successfully
Installing '/opt/php/lib/php/extensions/no-debug-non-zts-20090626/memcache.so'
install ok: channel://pecl.php.net/memcache-2.2.6
configuration option "php_ini" is not set to php.ini location
You should add "extension=memcache.so" to php.ini
[/shell]


CentOS下安装php的GD库

一、需要下载的软件包

<wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px">gd库相关包(<a href="http://www.libpng.org/pub/png/libpng.html" style="margin:0px; padding:0px; color:rgb(0,102,204)">http://www.libpng.org/pub/png/libpng.html</a>)</wbr></wbr></wbr>


<wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><a href="http://www.libgd.org/Main_Page" target="_blank" style="margin:0px; padding:0px; color:rgb(0,102,204)">gd-2.0.35.tar.gz</a><br style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><a href="http://www.ijg.org/" target="_blank" style="margin:0px; padding:0px; color:rgb(0,102,204)">jpegsrc.v7.tar.gz</a><br style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><a href="http://sourceforge.net/projects/libpng/files/00-libpng-stable/1.2.39/libpng-1.2.39.tar.gz/download" target="_blank" style="margin:0px; padding:0px; color:rgb(0,102,204)">libpng-1.2.39.tar.gz</a><br style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><a href="http://sourceforge.net/projects/libpng/files/zlib/1.2.3/zlib-1.2.3.tar.gz/download" target="_blank" style="margin:0px; padding:0px; color:rgb(0,102,204)">zlib-1.2.3.tar.gz</a><br style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><a href="http://ftp.twaren.net/Unix/NonGNU/freetype/" target="_blank" style="margin:0px; padding:0px; color:rgb(0,102,204)">freetype</a><a href="http://ftp.twaren.net/Unix/NonGNU/freetype/" target="_blank" style="margin:0px; padding:0px; color:rgb(0,102,204)">-2.3.9.tar.gz</a><br style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><br style="margin:0px; padding:0px"><p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> 二、安装php的GD库</p> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> 1.安装zlib</p> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> <wbr style="margin:0px; padding:0px"></wbr></p> <table bgcolor="#f1f1f1" border="1" cellpadding="0" cellspacing="0" style="margin:0px; padding:0px; border:1px solid rgb(192,192,192); border-collapse:collapse; width:1094px"><tbody style="margin:0px; padding:0px"><tr style="margin:0px; padding:0px"> <td style="margin:0px; padding:3px; border:1px solid rgb(192,192,192); border-collapse:collapse; word-break:normal!important"> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> <br style="margin:0px; padding:0px"> &gt;tar -zxvf zlib-1.2.3.tar.gz<br style="margin:0px; padding:0px"> &gt;cd zlib-1.2.3<br style="margin:0px; padding:0px"> &gt;./configure --prefix=/usr/local/zlib<br style="margin:0px; padding:0px"> &gt;make<br style="margin:0px; padding:0px"> &gt;make install</p> </td> </tr></tbody></table> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> <wbr style="margin:0px; padding:0px"></wbr></p> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> <br style="margin:0px; padding:0px"> 2.安装libpng</p> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> <wbr style="margin:0px; padding:0px"></wbr></p> <table bgcolor="#f1f1f1" border="1" cellpadding="0" cellspacing="0" style="margin:0px; padding:0px; border:1px solid rgb(192,192,192); border-collapse:collapse; width:1094px"><tbody style="margin:0px; padding:0px"><tr style="margin:0px; padding:0px"> <td style="margin:0px; padding:3px; border:1px solid rgb(192,192,192); border-collapse:collapse; word-break:normal!important"> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> <br style="margin:0px; padding:0px"> &gt;tar -zxvf libpng-1.2.39.tar.gz<br style="margin:0px; padding:0px"> &gt;cd libpng-1.2.39<br style="margin:0px; padding:0px"> &gt;cd scripts/</p> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> <br style="margin:0px; padding:0px"> &gt;mv makefile.linux ../makefile<wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px">//注意,这里的makefile不是用./configure生成,而是直接从scripts/里拷一个<br style="margin:0px; padding:0px"></wbr></wbr></wbr></p> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> <br style="margin:0px; padding:0px"> &gt;cd ..<br style="margin:0px; padding:0px"> &gt;make<br style="margin:0px; padding:0px"> &gt;make install</p> </td> </tr></tbody></table> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> <wbr style="margin:0px; padding:0px"></wbr></p> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> <br style="margin:0px; padding:0px"> 3.安装freetype</p> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> <wbr style="margin:0px; padding:0px"></wbr></p> <table bgcolor="#f1f1f1" border="1" cellpadding="0" cellspacing="0" style="margin:0px; padding:0px; border:1px solid rgb(192,192,192); border-collapse:collapse; width:1094px"><tbody style="margin:0px; padding:0px"><tr style="margin:0px; padding:0px"> <td style="margin:0px; padding:3px; border:1px solid rgb(192,192,192); border-collapse:collapse; word-break:normal!important"> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> <br style="margin:0px; padding:0px"> &gt;tar -zxvf freetype-2.3.9.tar.gz<br style="margin:0px; padding:0px"> &gt;cd freetype-2.3.9<br style="margin:0px; padding:0px"> &gt;./configure --prefix=/usr/local/freetype<br style="margin:0px; padding:0px"> &gt;make<br style="margin:0px; padding:0px"> &gt;make install</p> </td> </tr></tbody></table> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> <wbr style="margin:0px; padding:0px"></wbr></p> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> <br style="margin:0px; padding:0px"> 4.安装Jpeg</p> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> <wbr style="margin:0px; padding:0px"></wbr></p> <table bgcolor="#f1f1f1" border="1" cellpadding="0" cellspacing="0" style="margin:0px; padding:0px; border:1px solid rgb(192,192,192); border-collapse:collapse; width:1094px"><tbody style="margin:0px; padding:0px"><tr style="margin:0px; padding:0px"> <td style="margin:0px; padding:3px; border:1px solid rgb(192,192,192); border-collapse:collapse; word-break:normal!important"> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> <br style="margin:0px; padding:0px"> &gt;tar -zxvf jpegsrc.v7.tar.gz<br style="margin:0px; padding:0px"> &gt;cd jpeg-7<br style="margin:0px; padding:0px"> &gt;./configure --prefix=/usr/local/jpeg --enable-shared<wbr style="margin:0px; padding:0px">//这里configure一定要带--enable-shared参数,不然,不会生成共享库<br style="margin:0px; padding:0px"> &gt;make<br style="margin:0px; padding:0px"></wbr></p> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> <br style="margin:0px; padding:0px"> &gt;make test<br style="margin:0px; padding:0px"> &gt;make install</p> </td> </tr></tbody></table> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> <wbr style="margin:0px; padding:0px"></wbr></p> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> <br style="margin:0px; padding:0px"> 5.安装GD</p> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> <wbr style="margin:0px; padding:0px"></wbr></p> <table bgcolor="#f1f1f1" border="1" cellpadding="0" cellspacing="0" style="margin:0px; padding:0px; border:1px solid rgb(192,192,192); border-collapse:collapse; width:1094px"><tbody style="margin:0px; padding:0px"><tr style="margin:0px; padding:0px"> <td style="margin:0px; padding:3px; border:1px solid rgb(192,192,192); border-collapse:collapse; word-break:normal!important"> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> <br style="margin:0px; padding:0px"> &gt;tar -zxvf gd-2.0.35.tar.gz<br style="margin:0px; padding:0px"> &gt;cd gd-2.0.35<br style="margin:0px; padding:0px"> &gt;./configure --prefix=/usr/local/gd --with-png --with-freetype=/usr/local/freetype --with-jpeg=/usr/local/jpeg<br style="margin:0px; padding:0px"> &gt;make<br style="margin:0px; padding:0px"> &gt;make install</p> </td> </tr></tbody></table> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> <wbr style="margin:0px; padding:0px"></wbr></p> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> 6.重新编译PHP</p> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> <wbr style="margin:0px; padding:0px"></wbr></p> <table bgcolor="#f1f1f1" border="1" cellpadding="0" cellspacing="0" style="margin:0px; padding:0px; border:1px solid rgb(192,192,192); border-collapse:collapse; width:1094px"><tbody style="margin:0px; padding:0px"><tr style="margin:0px; padding:0px"> <td style="margin:0px; padding:3px; border:1px solid rgb(192,192,192); border-collapse:collapse; word-break:normal!important"> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> <br style="margin:0px; padding:0px"> &gt;cd php-5.3.0<br style="margin:0px; padding:0px"> &gt;./configure (以前的参数)<wbr style="margin:0px; padding:0px">--with-gd=/usr/local/gd --enable-gd-native-ttf --with-zlib=/usr/local/zlib --with-png --with-jpeg=/usr/local/jpeg --with-freetype=/usr/local/freetype --enable-sockets<br style="margin:0px; padding:0px"> &gt;make<br style="margin:0px; padding:0px"> &gt;make install<br style="margin:0px; padding:0px"></wbr></p> </td> </tr></tbody></table> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> <wbr style="margin:0px; padding:0px"></wbr></p> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> 三、常见问题及解决</p> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> <wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px">1、现象:安装gd时,make install提示如下问题:</wbr></wbr></p> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> <wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px">warning: macro `AM_ICONV' not found in library</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></p> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> <wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px">解决:yum -y install gettext</wbr></wbr></wbr></wbr></wbr></p> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> <wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px">2、现象:安装freetype时,configure的时候显示如下</wbr></wbr></p> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> <wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px">config.status: executing libtool commands<br style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px">make: Nothing to be done for `unix'.</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></p> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> <wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px">解决:make clean 然后再 make<wbr style="margin:0px; padding:0px"><wbr style="margin:0px; padding:0px">make install(此方法我在freetype2.3.5---2.3.9均试过,不能成功,还没有找到成功的解决方法)</wbr></wbr></wbr></wbr></wbr></wbr></wbr></p> <p style="margin:10px auto; padding-top:0px; padding-bottom:0px; text-indent:2em"> <br></p> </wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics