Apache+Php5+MySQL+GD+libxslt+jpeg6+libpng+Curl+freetype的安装(cnscn)

    .先找到 apache php mysql  源码包下载的URL地址
http://www.apache.org
http://www.php.net
http://www.mysql.com


.安装apache
1)解压源码包
   #tar -zxf httpd-2.0.55.tar.gz

2)进入安装目录
   #cd httpd-2.0.55

3)配置apache安装信息
   #./configure --prefix=/usr/local/apache   /
       --enable-modules=most  / (常用 模块)
       --enable-modules=so /
       --enable-rewrite

4)执行make安装
   # make; make install

5)修改httpd.conf
   # vi /usr/local/apache/conf/httpd.conf
   1> 找到 prefork.c 下的 MaxClients 150 改为
                                      ServerLimit 2000
                                      MaxClients 1000
      (apache默认工作在prefork.c 模式下,并发进程为150,超过后就无法访问,150是远远不够的,所以这里按自己 网站的需求改, 如1000
由于apache默认最大并发进程是 256 所以要先设置 ServerLimit 2000 将服务器可设的最大并发数设为2000, 然后再设置最大并发数 MaxClients 1000)

   2> 找到 #ServerName    www.example.com:80          在其下设置 ServerName 为你 网站名,也可用IP代替
        找到 DocumentRoot   "/usr/local/apache/htdocs"        设置你的 WEB 服务器的根 目录 如 DocumentRoot "/myweb"
        找到 DirectoryIndex index.html index.html.var           改为DirectoryIndex index.html index.php index.htm
        找到 ForceLanguagePriority Prefer Fallback               在其下加上 AddDefaultCharset gb2312

6)启动WEB服务器
   #/usr/local/apache/bin/apachectl start

   查看自己的站点是否正常 http://www.mysite.com 也可用IP
   (用# /usr/local/apache/bin/apachectl stop 可停止服务)


.安装MYSQL
1)Install
   # tar -zxf mysql-standard-5.0.15-linux-i686.tar.gz
   # cp -r mysql-standard-5.0.15-linux-i686 /usr/local/mysql

2)修改配置
   # vi /usr/local/mysql/support-files/my-medium.cnf 在后面加上
   max_connections = 1000
   log-slow-queries
   long_query_time = 5
  (注:
      max_connections  为允许的最大连接数
      log-slow-queries 打开低速查询日志
      long_query_time 低速查询的秒数(运行一句sql达到此 时间记录在日志里)
  )

  然后COPY 它为 /etc/my.cnf 文件
  #cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf

3)添加mysql用户及用户组
   # groupadd mysql
   # useradd -g mysql mysql

4)修改mysql目录权限
   # chown -R root /usr/local/mysql
   # chgrp -R mysql /usr/local/mysql
   # chown -R mysql /usr/local/mysql/data

5)生成mysql系统数据库
   # /usr/local/mysql/scripts/mysql_install_db --user=mysql&

6)启动mysql服务
   # /usr/local/mysql/bin/mysqld_safe --user=mysql&
   如出现 Starting mysqld daemon with databases from /usr/local/mysql/data   代表正常启动mysql服务了, 按Ctrl + C 跳出

7)修改 mysql 的 root 密码
   # /usr/local/mysql/bin/mysqladmin -u root -p password 123456
   回车出现 Enter password: 最开始密码默认为空 继续回车即可 123456 即为你的新密码

.安装PHP
1)安装GD库(让PHP支持GIF,PNG,JPEG)
   首先下载 jpeg6,libpng,freetype 并安装 模块
   wget http://www.ijg.org/files/jpegsrc.v6b.tar.gz
   wget http://nchc.dl.sourceforge.net/sourc...g-1.2.8.tar.gz
   wget http://keihanna.dl.sourceforge.net/s...-2.1.10.tar.gz
   wget http://www.boutell.com/gd/http/gd-2.0.33.tar.gz

  .安装 jpeg6
   建立 目录
   # mkdir /usr/local/jpeg6
   # mkdir /usr/local/jpeg6/bin
   # mkdir /usr/local/jpeg6/lib
   # mkdir /usr/local/jpeg6/include
   # mkdir /usr/local/jpeg6/man
   # mkdir /usr/local/jpeg6/man/man1
   # cd /root/soft
   # tar -zxf jpegsrc.v6b.tar.gz
   # cd jpeg-6b
   # ./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static
   # make; make install

  .安装libpng
   # cd /root/soft
   # tar -zxf libpng-1.2.8.tar.gz
   # cd libpng-1.2.8
   # cp scripts/makefile.std makefile
   # make; make install

   .安装 freetype
   # cd /root/soft
   # tar -zxf freetype-2.1.10.tar.gz
   # cd freetype-2.1.10
   # ./configure --prefix=/usr/local/freetype
   # make;make install

   .安装最新的GD库
   # cd /root/soft
   # tar -zxf gd-2.0.33.tar.gz
   # cd gd-2.0.33
   # ./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg6/ --with-png --with-zlib --with-freetype=/usr/local/freetype/
   # make; make install

.安装最新的Curl库
   # cd /root/soft
   # wget http://curl.haxx.se/download/curl-7.15.0.tar.gz
   # tar -zxf curl-7.15.0.tar.gz
   # ./configure --prefix=/usr/local/curl
   # make; make install

2)安装PHP
  .下载并安装libxml2
   # cd /root/soft
   # wget http://ftp.gnome.org/pub/GNOME/sourc...-2.6.19.tar.gz
   # tar -zxf libxml2-2.6.19.tar.gz
   # cd libxml2-2.6.19
   # ./configure --prefix=/usr/local/libxml2
   # make; make install

.安装 libxslt
   # cd /root/soft
   # wget http://ftp.gnome.org/pub/GNOME/sourc...-1.1.15.tar.gz
   # tar -zxf libxslt-1.1.15.tar.gz
   # cd libxslt-1.1.15
   # ./configure --prefix=/usr/local/libxslt --with-libxml-prefix=/usr/local/libxml2
   # make; make install

   .开始安装PHP5
   # tar -zxf php-5.0.5.tar.gz
   # cd php-5.05
   # ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql/ --with-curl=/usr/local/curl --enable-ftp --with-libxml-dir=/usr/local/libxml2 --with-expat-dir=/usr/lib --enable-soap --with-xsl=/usr/local/libxslt --enable-xslt --with-gd=/usr/local/gd2/ --with-jpeg-dir=/usr/local/jpeg6/ --with-zlib-dir=/usr/lib --with-png --with-freetype-dir=/usr/local/freetype
   # make
   # make install

   必选项
      --prefix=/usr/local/php
      --with-apxs2=/usr/local/apache/bin/apxs
      --with-mysql=/usr/local/mysql/
      --with-libxml-dir=/usr/local/libxml2
  
   GD库的配置选项
      --with-gd=/usr/local/gd2/
      --with-jpeg-dir=/usr/local/jpeg6/
      --with-png
      --with-zlib-dir=/usr/lib
      --with-freetype-dir=/usr/local/freetype

   可选项  
      --with-curl=/usr/local/curl   支持CURL库
      --enable-ftp                       打开FTP库函数支持
      --enable-soap --with-xsl=/usr/local/libxslt --enable-xslt   让PHP支持SOAP

.配置 httpd.conf 让apache支持PHP
   # vi /usr/local/apache/conf/httpd.conf
      找到 AddType application/x-gzip .gz .tgz 在其下添加如下 内容
      AddType application/x-httpd-php .php
      AddType application/x-httpd-php-source .phps

   重启apache
     # /usr/local/apache/bin/apachectl restart
     在你Web 目录里建一 内容为  PHP文件, 输入URL地址查看PHP配置是否正确
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值