[转载]PHP+GD的安装
2006-08-26 00:57 | Filed Under Linux |
http://www.xxlinux.com/linux/article/network/server/20051129/212.html
标签:gd, jpeg, Linux, PHP, png一、下载
gd-2.0.33.tar.gz http://www.boutell.com/gd/
jpegsrc.v6b.tar.gz http://www.ijg.org/
libpng-1.2.7.tar.tar http://sourceforge.net/projects/libpng/
zlib-1.2.2.tar.gz http://sourceforge.net/projects/zlib/
freetype-2.1.9.tar.gz http://sourceforge.net/projects/freetype/
php-4.3.9.tar.gz http://www.php.net
二、说明
最新的GD库包括了对GIF的支持,所以不要打GIF补丁
http://sourceforge.net/ 好多源代码包可以在上面找到
安装步骤:
先安装zlib,freetype,libpng,jpeg,再装GD,再装PHP
三、安装
1.装zlib
tar zxvf zlib-1.2.2.tar.gz
cd zlib-1.2.2
./configure
make
make install2.安装libpng
tar zxvf libpng-1.2.7.tar.tar
cd libpng-1.2.7
cd scripts/
mv makefile.linux ../makefile
cd ..
make
make install
注意,这里的makefile不是用./configure生成,而是直接从scripts/里拷一个3.安装freetype
tar zxvf freetype-2.1.9.tar.gz
cd freetype-2.1.9
./configure
make
make install4.安装Jpeg
tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b/
./configure –enable-shared
make
make test
make install
注意,这里configure一定要带–enable-shared参数,不然,不会生成共享库5.安装GD
tar zxvf gd-2.0.33.tar.gz
cd gd-2.0.33
./configure –with-png –with-freetype –with-jpeg
make
make install6.安装PHP
tar zxvf php-4.3.9.tar.gz
cd php-4.3.9
./configure –with-apxs2=/usr/local/apache2/bin/apxs –with-mysql –with-gd –with-zlib –with-png –with-jpeg –with-freetype –enable-sockets
make
make install7.配置Apache支持PHP
8.测试
phpinfo();Ok…..
还有问题请来论坛寻求帮助:http://www.xxlinux.com/bbs/
相关日志
删除字符串中多余的换行
2006-07-22 08:56 | Filed Under PHP |
function remove_blank_lines($content) {
$result = explode("\n", $content);
for ($i = 0; $i < count($result); $i ++) {
if (trim($result[$i]) != "") {
$new_content .= $result[$i];
$new_content .= "\n";
}
}
return $new_content;
}
很笨的方法,不是么~
写这个过程中还明白了单双引号的区别,真是惭愧。。。
底下大大给的高级方法:
function remove_blank_lines($content) {
return preg_replace("/(\s*?\r?\n\s*?)+/","\n",$content);
}
配合这里学习正则表达式。
标签:PHP, 换行, 正则表达式相关日志


