自分は使うことは無いので触る予定はありませんでしたが利用者が使いたい方もおられるでしょうので一応対応させました。
これはその際のメモです。
# yum install *python*
# ln -s /usr/bin/python /usr/local/bin/python
これで対応します。
Python CGIプログラミング入門
ここの例文を利用させていただいたところ無事動作を確認できました^^
自分は使うことは無いので触る予定はありませんでしたが利用者が使いたい方もおられるでしょうので一応対応させました。
これはその際のメモです。
# yum install *python*
# ln -s /usr/bin/python /usr/local/bin/python
これで対応します。
Python CGIプログラミング入門
ここの例文を利用させていただいたところ無事動作を確認できました^^
色々と足りないのがあるのでインストールします。
※私の環境ではpythonは使える環境にありました。
# apt-get install python
# apt-get install python-devel
# apt-get install python-egenix-mx-base
# apt-get install python-tools
# apt-get install python-setuptools
# apt-get install python-babel
# apt-get install python-genshi
# apt-get install mod_python
基本.htaccessを使わないといけなくなるのでhttpd.confには以下の設定に変更しておく。
# vi /etc/apache2/conf/httpd.conf
AllowOverride NoneをAllowOverride FileInfoへ設定
# service apache2 restart
PythonをCGIで使う場合文字化けのためかshiftがエラーになったのでUTF-8で書きましょう。
hello.pyをcgiとして動かす場合は下記のような設定を.htaccessへ記述する。
AddHandler mod_python .py
PythonHandler hello
PythonDebug On
hello.pyの内容
from mod_python import apache
def handler(req):
req.content_type = "text/plain"
req.send_http_header()
req.write("Hello, World")
return apache.OK
# end.
毎回スクリプトごとに設定してたら気が狂うので下記のような設定方法もあります。
AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On
慣れないですね^^;
やっぱりPerlが使いやすいかな・・・・・・