日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > php >内容正文

php

php配置GD库

發布時間:2025/3/19 php 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 php配置GD库 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

一 所需軟件?
jpegsrc.v6b.tar.gz
freetype-2.1.10.tar.gz
zlib-1.2.3.tar.gz
libpng-1.2.12.tar.gz
gd-2.0.33.tar.gz
libxml2-2.6.23.tar.bz2
ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz

二 安裝順序
1 mysql
2 apache
3 JPEG包
4 TTF包
5 zlib包(libpng包)
6 libpng包
7 GD包
8 XML包(libxml)
9 php
10 Zend

三 安裝過程

1 mysql?
看mysql、php配置

2 apache?
# tar zxvf httpd-2.2.6.tar.gz
# cd httpd-2.2.6
# ./configure --prefix=/usr/local/apache2 --enable-so --enable-track-vars --enable-proxy --enable-vhost-alias --enable-cache --enable-disk-cache --enable-mem-cache --enable-rewrite --enable-mods-shared=all
# make
# make install

3 JPEG包
# tar zxvf jpegsrc.v6b.tar.gz
# cd jpeg-6b/
# mkdir /usr/local/jpeg
# mkdir /usr/local/jpeg/bin
# mkdir /usr/local/jpeg/lib
# mkdir /usr/local/jpeg/include
# mkdir /usr/local/jpeg/man
# mkdir /usr/local/jpeg/man/man1
# ./configure --prefix=/usr/local/jpeg
# make
# make install
# make install-lib

4 TTF包
# tar zxvf freetype-2.1.10.tar.gz
# cd freetype-2.1.10
# ./configure --prefix=/usr/local/freetype
# make
# make install

5 zlib包
# tar zxvf zlib-1.2.3.tar.gz
# cd zlib-1.2.3
# ./configure
# make
# make install

6 libpng包
# tar zxvf libpng-1.2.12.tar.gz
# cd libpng-1.2.12
# ./configure
# make
# make install

7 GD包
# tar zxvf gd-2.0.33.tar.gz
# cd gd-2.0.33
# ./configure
# make
# make install
# cp gd.h /usr/local/lib/

8 XML包(libxml)
# tar jxvf libxml2-2.6.23.tar.bz2
# cd libxml2-2.6.23
# ./configure
# make
# make install

9 php
# tar zxvf php-5.2.5.tar.gz
# cd php-5.2.5
# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-gd --with-jpeg-dir=/usr/local/jpeg --with-ttf --with-freetype-dir=/usr/local/freetype --with-zlib --with-png --with-mysql=/usr/local/mysql/ --with-mbstring --enable-mbstring=all --enable-mbstr-enc-trans? --enable-mbregex --enable-track-vars
# make
# make install
# cp php.ini-dist /usr/local/php/lib/php.ini

httpd.conf
AddType application/x-httpd-php .php .phtml

10 Zend
# tar zxvf ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz
# cd ZendOptimizer-3.3.3-linux-glibc23-i386
# ./install.sh

四 成功提示
寫個test.php
<?php?
phpinfo();
?>

頁面搜索gd,顯示如下表示成功
GD Support? enabled??
GD Version? bundled (2.0.34 compatible)??
FreeType Support? enabled??
FreeType Linkage? with freetype??
FreeType Version? 2.1.10??
GIF Read Support? enabled??
GIF Create Support? enabled??
JPG Support? enabled??
PNG Support? enabled??
WBMP Support? enabled??
XBM Support? enabled?


頁面搜索Zend顯示如下信息
with Zend Optimizer v3.3.3, Copyright (c) 1998-2007, by Zend Technologies


五 --enable-rewrite

在編譯apache時加了個--enable-rewrite,apache偽靜態html

借用同事的一個例子
# vim /usr/local/apache2/conf/httpd.conf

在httpd.conf中加入以下
<IfModule mod_rewrite.c>
??? RewriteEngine On
??? RewriteRule ^/a([0-9]+).html$ /a$1.php [L]
</IfModule>

測試
目錄下有a1.php? a2.php? a3.php
當輸入a1.html? a2.html? a3.html時,訪問的是以上php文件

同事在做項目時已經把里面的鏈接全寫成了html格式

六 --enable-rewrite 防盜鏈

<Directory "e:/Work/upload">
???? RewriteEngine on
???? RewriteCond %{HTTP_REFERER} !^http://www.123.com/.*$ [NC]
???? RewriteRule .*/.(ppt|zip|rar|doc|wps)$?? http://www.123.com/404.html [L]
</Directory>

七 ?關于shtml
apache默認是不支持SSI的,需要我們更改httpd.conf來進行配置。

# vim /usr/local/apache2/conf/httpd.conf

把這兩行前面的#去掉
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml

然后搜索"Options Indexes FollowSymLinks"
在搜索到的那一行后面添加"Includes"
即將該行改變為Options Indexes FollowSymLinks Includes

測試寫一個test.shtml,內容如下
<!--#include file="test.php"-->

關于SSI可以訪問
http://hi.baidu.com/hugang/blog/item/370b542cf4ba2cef8b139926.html

轉載于:https://www.cnblogs.com/mazefeng/p/3357603.html

總結

以上是生活随笔為你收集整理的php配置GD库的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。