懵懵燈燈的BLOG

          寒夜孤燈點點星

            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            56 隨筆 :: 10 文章 :: 22 評論 :: 0 Trackbacks
          1.安裝flex(fast lex)
          ??? 下載GNU Flex: flex-2.5.35.tar.gz
          ??? > tar zxvf flex-2.5.35.tar.gz
          ??? > cd flex-2.5.35
          ??? > ./configure --prefix=/usr/local/flex
          ??? > make
          ??? > sudo make install
          2.安裝python
          ??? 下載Python-2.5.2.tgz
          ??? > tar zxvf Python-2.5.2.tgz
          ??? > cd Python-2.5.2
          ??? > ./configure --prefix=/usr/local/python
          ??? 〉make
          ??? > sudo make install
          3.安裝mod_python
          ??? 下載mod_python-3.3.1.tgz
          ??? > tar zxvf mod_python-3.3.1.tgz
          ??? > cd mod_python-3.3.1
          ??? > ./configure --with-apxs=/usr/local/apache/bin/apxs \
          ??? > --with-python=/usr/local/bin/python2.5? \
          ??? > --with-mutex-dir=/var/run/mod_python \
          ??? > --with-max-locks=32 \
          ??? > --with-flex=/usr/local/bin/flex \
          ??? > --with-python-src=/usr/src/python2.5

          4. 配置Apache 服務器
          ??? > sudo vi /usr/local/apache/conf/httpd.conf
          ??? 增加如下行:
          ??? LoadModule python_module libexec/mod_python.so
          5. 測試

          ??? 1) 建立測試目錄
          ??? > cd /usr/local/apache/htdocs
          ??? > sudo mkdir test
          ??? 2) 建立測試文件
          ??? > cd test
          ??? > sudo vi mptest.py
          ??? ? 輸入下面幾行:
          from?mod_python?import?apache

          def?handler(req):
          ????req.content_type?
          =?'text/plain'
          ????req.write(
          "Hello?World!")
          ????
          return?apache.OK


          3)配置測試目錄
          > sudo vi /usr/local/apache/conf/httpd.conf
          增加如下幾行:
          <Directory /some/directory/htdocs/test>
          AddHandler mod_python .py
          PythonHandler mptest
          PythonDebug On
          </Directory>

          4)重新啟動apache服務器
          > sudo /etc/init.d/apache restart

          5) 瀏覽器訪問
          > w3m localhost/test/anyname.py

          ... Hello World!




          ???


          ???

          posted on 2008-06-05 19:55 懵懵燈燈 閱讀(358) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 湖州市| 禄劝| 千阳县| 蒙自县| 龙江县| 抚顺市| 和林格尔县| 唐河县| 建宁县| 阿合奇县| 甘德县| 屏山县| 温州市| 称多县| 连云港市| 司法| 宿迁市| 阳谷县| 呼图壁县| 梨树县| 沾化县| 衡阳市| 九龙城区| 密山市| 柳州市| 裕民县| 星座| 孟村| 达孜县| 嵩明县| 廉江市| 弥勒县| 和静县| 来宾市| 邵东县| 通州市| 孟连| 黄平县| 九台市| 五家渠市| 青岛市|