本文的copyright归[email protected] 所有,使用GPL发布,可以自由拷贝,转载。但转载请保持文档的完整性,注明原作者及原链接,严禁用于任何商业用途。
作者:[email protected]
博客:
yuweixian4230.blog.chinaunix.net 


php : hypertext prorocessor 超文本预处理程序

ubuntu10.10 源码安装apache php

1. 下载源码

apache download
http://httpd.apache.org/download.cgi

php download
http://php.net/downloads.php


2. 参考安装文档

http://fengzheng369.blog.163.com/blog/static/75220979201092883119968/


3. 安装apache

  1. root@ywx:/home/ywx/yu/apache/httpd-2.2.19# ./configure --prefix=/usr/local/apache --enable-so
  2. root@ywx:/home/ywx/yu/apache/httpd-2.2.19# make
  3. root@ywx:/home/ywx/yu/apache/httpd-2.2.19# make install

4. 安装php

  1. root@ywx:/home/ywx/yu/apache/php-5.3.7# apt-get install libxml2-dev
  2. root@ywx:/home/ywx/yu/apache/php-5.3.7# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs
  3. root@ywx:/home/ywx/yu/apache/php-5.3.7# make;make install
  4. root@ywx:/home/ywx/yu/apache/php-5.3.7# cp php.ini-development /usr/local/lib/php.ini

5. 配置文件

  1. root@ywx:/usr/local/apache/conf# gedit httpd.conf
  2. 找到AddType的那节,在下面加上:

  3. AddType application/x-httpd-php .php .phtml .php3  ##注意空格
    Addtype application/x-httpd-php-source .phps

  4. LoadModule php5_module modules/libphp5.so

6. 运行apache
  1. root@ywx:/usr/local/apache/bin# ./apachectl start
  2. httpd (pid 25721) already running
  3. root@ywx:/usr/local/apache/bin# ./apachectl restart
  4. root@ywx:/usr/local/apache/bin# ./apachectl stop
  5. root@ywx:/usr/local/apache/bin# ./apachectl start
  6. root@ywx:/usr/local/apache/bin# ./apachectl start
  7. httpd (pid 25774) already running
  8. root@ywx:/usr/local/apache/bin#


7. 测试

 启动apache
root@ywx:/home/ywx/yu# /usr/local/apache/bin/apachectl start

root@ywx:/home/ywx/yu# /usr/local/apache/bin/httpd -k start

vim test.php
  1. <?php
  2.         phpinfo();
  3. ?>

将 test.php 复制到 /usr/local/apache/htdocs/ 下


chmod u+x test.php

打开浏览器访问

1  apache php 源码安装 测试-LMLPHP



10-06 04:39