当前位置:Gxlcms > PHP教程 > phpgd库的安装与PHP伪静态

phpgd库的安装与PHP伪静态

时间:2021-07-01 10:21:17 帮助过:3人阅读

  1. # tar zxvf httpd-2.2.6.tar.gz
  2. # cd httpd-2.2.6
  3. # ./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
  4. # make
  5. # make install

3,JPEG包

  1. # tar zxvf jpegsrc.v6b.tar.gz
  2. # cd jpeg-6b/
  3. # mkdir /usr/local/jpeg
  4. # mkdir /usr/local/jpeg/bin
  5. # mkdir /usr/local/jpeg/lib
  6. # mkdir /usr/local/jpeg/include
  7. # mkdir /usr/local/jpeg/man
  8. # mkdir /usr/local/jpeg/man/man1
  9. # ./configure --prefix=/usr/local/jpeg
  10. # make
  11. # make install
  12. # make install-lib

4,TTF包

  1. # tar zxvf freetype-2.1.10.tar.gz
  2. # cd freetype-2.1.10
  3. # ./configure --prefix=/usr/local/freetype
  4. # make
  5. # make install

5,zlib包

  1. # tar zxvf zlib-1.2.3.tar.gz
  2. # cd zlib-1.2.3
  3. # ./configure
  4. # make
  5. # make install

6,libpng包

  1. # tar zxvf libpng-1.2.12.tar.gz
  2. # cd libpng-1.2.12
  3. # ./configure
  4. # make
  5. # make install

7,php gd库

  1. # tar zxvf gd-2.0.33.tar.gz
  2. # cd gd-2.0.33
  3. # ./configure
  4. # make
  5. # make install
  6. # cp gd.h /usr/local/lib/

8,XML库(libxml)

  1. # tar jxvf libxml2-2.6.23.tar.bz2
  2. # cd libxml2-2.6.23
  3. # ./configure
  4. # make
  5. # make install

9,php

  1. # tar zxvf php-5.2.5.tar.gz
  2. # cd php-5.2.5
  3. # ./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
  4. # make
  5. # make install
  6. # cp php.ini-dist /usr/local/php/lib/php.ini

httpd.conf

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

10,Zend

  1. # tar zxvf ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz
  2. # cd ZendOptimizer-3.3.3-linux-glibc23-i386
  3. # ./install.sh

四,创建测试页

  1. phpinfo();
  2. ?>

页面搜索gd,显示如下则表示成功:

  1. RewriteEngine On
  2. RewriteRule ^/a([0-9]+).html$ /a$1.php [L]

测试是否成功: 目录下有a1.php a2.php a3.php 当输入a1.html a2.html a3.html时,访问的是以上php文件

在做项目时已其中的链接全写成了html格式。

六,--enable-rewrite 防盗链

  1. RewriteEngine on
  2. RewriteCond %{HTTP_REFERER} !^http://www.123.com/.*$ [NC]
  3. RewriteRule .*/.(ppt|zip|rar|doc|wps)$ http://www.123.com/404.html [L]

七,关于shtml apache默认是不支持SSI的,需要更改httpd.conf来进行配置。 # vim /usr/local/apache2/conf/httpd.conf 把这两行前面的#去掉

  1. AddType text/html .shtml
  2. AddOutputFilter INCLUDES .shtml

然后,搜索"Options Indexes FollowSymLinks" 在搜索到的那一行后面添加"Includes" 即将该行改变为: Options Indexes FollowSymLinks Includes

测试,创建文件test.shtml,内容如下:

人气教程排行