红联Linux门户
Linux帮助

Linux下安装PHP的GD

发布时间:2007-11-22 01:18:14来源:红联作者:Fromlung
昨天,在CentOS系统上,安装Fleaphp,运行其中一个“像册”范例,其功能包括上传图片,并生成图片的缩略图,发现不能对图片进行处理,报错:Call to undefined function: imagecreatefromjpeg() in。

于是查手册,猜测是没有安装GD,到网上找到了《GD:Linux下安装PHP的GD支持库》一文,依此安装,但是发现并不适合我的当前情况,因为我的系统已用yum安装了php,晚上就此问题请教甜饼,得知,yum install php-gd即可。

今天照此操练,但由于粗心,误将php-gd写为php-gb,所以报错:[code]Reading repository metadata in from local files
primary.xml.gz 100% |=========================| 1.0 MB 00:28
http://apt.sw.be/redhat/el4/en/i386/dag/repodata/primary.xml.gz: [Errno -1] Metadata file does not match checksum
Trying other mirror.
Error: failure: repodata/primary.xml.gz from dag: [Errno 256] No more mirrors to try.[/code]由于,没有发现这个输入错误,所以手工下载了primary.xml.gz,但是这个文件应该放在哪里呢,于是就此问题请教小仲,“只要你能让yum找到这个文件就可以了”。rpm -ql php,查到php的安装路径,猜测应该将primary.xml.gz文件复制到/usr/share/doc。

然后再次yum install php-gb,yum果然找到了它:[code]Reading repository metadata in from local files
primary.xml.gz 100% |=========================| 1.8 MB 00:34
dag : ################################################## 7811/7811
Added 1 new packages, deleted 0 old in 40.68 seconds
Parsing package install arguments
No Match for argument: php-gb
Nothing to do[/code]这是才发现这个输入错误,于是重新yum -y install php-gd,安装成功,“像册”范例运行正确。
文章评论

共有 0 条评论