<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    您好朋友,感謝您關注xiaosilent,我在blogjava的博客已經停止更新,請訪問http://kuan.fm了解我的最新情況,謝謝!
    隨筆-82  評論-133  文章-0  trackbacks-0
    最近開始看《Ajax for Dummies》,書里的示例一些是基于php的,所以需要建個php服務器才可以演示這些示例。拿自己的Ubuntu試了一下。
    1.準備工作
    先分別從http://httpd.apache.orghttp://www.php.net下載回httpd2和php5的源碼包,分別為:httpd-2.2.3.tar.gz和php-5.2.0.tar.gz。
    在編譯之前,先大概瀏覽一下它們的INSTALL文件,看看都有哪些說明。
    httpd的說明很簡單,再看php的說明,里面有一段是:
    ? Prerequisite knowledge and software for compiling:

    ???? * Basic Unix skills (being able to operate "make" and a C compiler)
    ???? * An ANSI C compiler
    ???? * flex: Version 2.5.4
    ???? * bison: Version 1.28 (preferred), 1.35, or 1.75
    ???? * A web server
    ???? * Any module specific components (such as gd, pdf libs, etc.)
    也就是說,要有C編譯器,flex,bison,一個web服務器,還要一些模塊的組件。由于計劃用apache做web服務器程序,基本編譯環境早就裝好(如果沒有,就sudo apt-get install build-essential 安裝之。),就看flex和bison這兩個東東了。
    新立得里面搜索了一下,有是有,就不知道是不是版本太陳舊了。還是問了一下google,得到了flex和bison的地址,http://www.gnu.org/software/flex/http://www.gnu.org/software/bison/。分別下載回源碼包,然后先編譯安裝這兩個東西,同樣看了看說明,直接
    ./configure
    make
    sudo?make?install


    2.開始安裝Apache
    ?再回過頭來看php的說明。
    文件里先講到的是apache1.3.×的版本如何編譯,這里我下載的是2.2.3版的Apache了,直接跳過這一節,看關于Apache2的編譯安裝說明。

    ?? Example 2-4. Installation Instructions (Apache 2 Shared Module
    ?? Version)
    1.? gzip -d httpd-2_0_NN.tar.gz
    2.? tar xvf httpd-2_0_NN.tar
    3.? gunzip php-NN.tar.gz
    4.? tar -xvf php-NN.tar
    5.? cd httpd-2_0_NN
    6.? ./configure --enable-so
    7.? make
    8.? make install

    ??? Now you have Apache 2.0.NN available under /usr/local/apache2,
    ??? configured with loadable module support and the standard MPM prefork.
    ??? To test the installation use your normal procedure for starting
    ??? the Apache server, e.g.:
    ??? /usr/local/apache2/bin/apachectl start
    ??? and stop the server to go on with the configuration for PHP:
    ??? /usr/local/apache2/bin/apachectl stop.


    前面還有一點版本方面的說明就不管了,根據示例,進入httpd的文件夾,直接執行? ./configure --enable-so來編譯apache就可以了。考慮到,Apache在我機器上待的時間可能不長,如果按默認的安裝,安裝到/usr/local下面去,我可能過幾天就忘了,找不到了。就用prefix參數修改一下安裝路徑。??
    ./configure?--enable-so?--prefix=/opt/apache
    然后就是等待配置的完成,生成Makefile,完了之后就 make 一下,現在可以去泡杯茶了。水燒開,茶泡好,sudo make install? 完成Apache的安裝。興沖沖地轉到/opt/apache/bin目錄, sudo ./apachectl start ,然后在FF里localhost一下,“It works!”,em,不錯,apache已經可以運行了。 趕緊,sudo ./apachectl stop 。

    3.開始編譯PHP5
    還是看說明:
    9.? cd ../php-NN

    10. Now, configure your PHP.? This is where you customize your PHP
    ??? with various options, like which extensions will be enabled.? Do a
    ??? ./configure --help for a list of available options.? In our example
    ??? we'll do a simple configure with Apache 2 and MySQL support.? Your
    ??? path to apxs may differ, in fact, the binary may even be named apxs2 on
    ??? your system.

    ????? ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql

    11. make
    12. make install

    ??? If you decide to change your configure options after installation,
    ??? you only need to repeat the last three steps. You only need to
    ??? restart apache for the new module to take effect. A recompile of
    ??? Apache is not needed.

    ??? Note that unless told otherwise, 'make install' will also install PEAR,
    ??? various PHP tools such as phpize, install the PHP CLI, and more.


    進入到php源碼目錄,示例中是? ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql這樣的,但是,我不需要安裝mysql,apache的安裝目錄也不是/usr/local/apache2,所以,稍做修改?
    ./configure?--with-apxs2=/opt/apache/bin/apxs?--prefix=/opt/php
    然后,除了等就還是等了 :( 機子破了點,沒辦法。(在等待的時間里,“我還抽了點時間洗了個澡,換了件衣服~~”)。然后,make 一下,這次,我去會了會新導師~~~,回來的時候,sudo make install 。到此,編譯安裝結束。

    4.配置Apache,是php能夠運行起來
    再看說明:
    13. Setup your php.ini

    ??? cp php.ini-dist /usr/local/lib/php.ini

    ??? You may edit your .ini file to set PHP options.? If you prefer having
    ??? php.ini in another location, use --with-config-file-path=/some/path in
    ??? step 10.

    ??? If you instead choose php.ini-recommended, be certain to read the list
    ??? of changes within, as they affect how PHP behaves.

    14. Edit your httpd.conf to load the PHP module.? The path on the right hand
    ??? side of the LoadModule statement must point to the path of the PHP
    ??? module on your system.? The make install from above may have already
    ??? added this for you, but be sure to check.

    ??? For PHP 4:

    ????? LoadModule php4_module modules/libphp4.so

    ??? For PHP 5:

    ????? LoadModule php5_module modules/libphp5.so

    15. Tell Apache to parse certain extensions as PHP.? For example,
    ??? let's have Apache parse the .php extension as PHP.? You could
    ??? have any extension(s) parse as PHP by simply adding more, with
    ??? each separated by a space.? We'll add .phtml to demonstrate.

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

    ??? It's also common to setup the .phps extension to show highlighted PHP
    ??? source, this can be done with:

    ????? AddType application/x-httpd-php-source .phps

    16. Use your normal procedure for starting the Apache server, e.g.:

    ????? /usr/local/apache2/bin/apachectl start

    ?? Following the steps above you will have a running Apache 2.0 with
    ?? support for PHP as SAPI module. Of course there are many more
    ?? configuration options available for both, Apache and PHP. For more
    ?? information use ./configure --help in the corresponding source tree.
    ?? In case you wish to build a multithreaded version of Apache 2.0 you
    ?? must overwrite the standard MPM-Module prefork either with worker or
    ?? perchild. To do so append to your configure line in step 6 above
    ?? either the option --with-mpm=worker or --with-mpm=perchild. Take care
    ?? about the consequences and understand what you are doing. For more
    ?? information read the Apache documentation about the MPM-Modules.

    經過這樣簡單的步驟,再啟動Apache,就可以執行php腳本了。
    posted on 2006-11-23 15:45 xiaosilent 閱讀(934) 評論(1)  編輯  收藏 所屬分類: Linux相關

    評論:
    # re: Apache與PHP的整合(編譯安裝),不涉及MySQL數據庫的整合 2006-11-30 19:42 | 張豬兒
    過來確認一下你是哪個,但是還是不曉得你是哪個.......  回復  更多評論
      
    主站蜘蛛池模板: 亚洲AV综合色区无码二区偷拍| 亚洲精品NV久久久久久久久久| ASS亚洲熟妇毛茸茸PICS| 免费国产午夜高清在线视频| 亚洲无线观看国产精品| jyzzjyzz国产免费观看| 色欲国产麻豆一精品一AV一免费| 亚洲一区二区三区在线视频| 黄色毛片免费在线观看| 亚洲美女高清一区二区三区| 黄页网址在线免费观看| 亚洲伊人成无码综合网 | 亚洲黄色在线播放| 亚洲色成人WWW永久在线观看| 三级片免费观看久久| 亚洲国产精品狼友中文久久久| 二级毛片免费观看全程| 国产V亚洲V天堂A无码| 久久久久免费精品国产| 亚洲小说区图片区| 国产片免费在线观看| 日本在线观看免费高清| 国产国拍亚洲精品mv在线观看| 99热这里只有精品6免费| 国产精品V亚洲精品V日韩精品| sihu国产精品永久免费| 久久亚洲春色中文字幕久久久| 一出一进一爽一粗一大视频免费的| 国产精品亚洲产品一区二区三区| 久久伊人免费视频| 亚洲国产成人综合| 亚洲av麻豆aⅴ无码电影| 亚洲精品456人成在线| 日本高清免费中文字幕不卡| 国产 亚洲 中文在线 字幕| 免费一级毛片女人图片| 男人都懂www深夜免费网站| 亚洲国产日韩综合久久精品| 亚洲综合最新无码专区| 午夜免费1000部| 亚洲国产成人精品不卡青青草原|