Tags

Recent Entries

Recent Comments

Recent Trackback

Feeds

More Links

OSXでLiteSpeed+PHP+Mysqlな環境を作る

[Permalink] [Post to del.icio.us] [Post to hatena] [Post to livedoorClip]
OSXでのWEB開発環境として、最近はLiteSpeed+PHP+Mysqlを使っています。
LiteSpeedはApacheやLighttpd等と同じくWEBサーバですが、速度が幾分か速い・設定が容易という噂を聞いて使い始めました。
ただ何も考えずにインストールしただけではすんなり動いてはくれませんので、インストールの手順を残しておきます。

LiteSpeed本体のインストール

1.バイナリのダウンロード


とりあえず公式ページからLiteSpeedのバイナリをダウンロードします。
今回はMacBookですのでMac OSX (Intel)をダウンロードしました。(Enterprise EditionとStandard EditionがありますのでFreeで利用できるStandard Editionを選択します。)

2.インストール


ダウンロードしたlsws-2.X.X-std-i386-osx.tar.gzを解凍しinstall.shを実行します。
 tar xzvf lsws-2.X.X-std-i386-osx.tar.gz
$ cd lsws-2.X.X
$ sudo ./install.sh
Do you agree with above Lisence ? Yes
Destination: /usr/local/lsws
User name : admin
Password: ******
Retype password: ******
User : www
Group : www
HTTP port : 80
Admin HTTP port : 7080
Setup up PHP : Y
Suffix for PHP script(comma separated list) : php
Would you like to change PHP opcode cache setting ? N
Would you like to install AWStats Add-on module ? N
Would you like to import Apache configuration ? N
Would you like to have LiteSpeed Web Server started automatically when the machine restarts ? Y
Would you like to start it right now ? Y
[OK] lshttpd: pid=XXXX.
LiteSpeed Web Server started successfully! Have fun!

これでインストールは完了です。簡単。

PHP+Mysqlのインストール

1.Mysqlのインストール


MysqlはOSX用のバイナリをインストールしました。特記すべき事は無くすんなりインストールできます。

2.PHPインストール


PHPに関しては本来はLiteSpeed付属のphpLsapiを使えばインストールの必要もなく動作しますが、mb関数やGD関数などデフォルトでは使用できない関数があったりしますので独自にビルドする必要があります。

今回はlitespeedのAPI用にコンパイルします。以下ページにも詳しい情報があります。
http://litespeedtech.com/support/wiki/doku.php?id=litespeed_wiki:php:lsapi

PHPのダウンロードページからPHPのソースコードをダウンロードし解凍しておきます。次に解凍したディレクトリ内のsapiディレクトリにPHP用のLSAPIをダウンロードして展開しておきます。
 tar xzvf php-5.1.X.tar.gz
$ cd php-5.1.X/sapi
$ wget http://www.litespeedtech.com/packages/lsapi/php-litespeed-2.x.tgz
$ tar xzvf php-litespeed-2.x.tgz

以下のコマンドを実行した後、必要なオプションをつけてコンパイルを行います。※GD等を使用するにはあらかじめ必要なライブラリ(libjpeg,gd等)をインストールしておいてください。
 cd ..
$ touch ac*
$ ./buildconf --force

$ ./configure --prefix=/usr/local/php5 \
--with-litespeed \
--enable-mbstring --enable-mbregex \
--with-zlib --with-mysql=/usr/local/mysql --with-zlib-dir=/usr/local \
--with-iconv --with-gd \
--with-jpeg-dir=/sw --with-png-dir=/sw --with-tiff-dir=/sw
$ make

コンパイルが正常に完了したらインストールを行います。このとき、LiteSpeed付属のlsphpを独自にコンパイルしたものと入れ替えます。
 sudo make install
$ sudo cp /usr/local/lsws/fcgi-bin/lsphp /usr/local/lsws/fcgi-bin/lsphp_old
$ sudo cp sapi/litespeed/php /usr/local/lsws/fcgi-bin/lsphp

以上でPHPのインストールは完了です。一応動作確認の為以下コマンドを実行し正常にバージョン情報が表示されることを確認しておきます。
 /usr/local/lsws/fcgi-bin/lsphp -v
PHP 5.1.6 (litespeed) (built: Sep 23 2006 12:48:22)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies

3.PHPの設定


PHPのソースディレクトリにあるphp.ini-distをコピーして設定ファイルを編集しマルチバイト関連の設定を変更しておきます。
 sudo cp php.ini-dist /usr/local/php5/lib/php.ini
$ sudo vi /usr/local/php5/lib/php.ini
mbstring.language = Japanese
mbstring.internal_encoding = UTF-8
mbstring.http_input = auto
mbstring.http_output = pass
mbstring.encoding_translation = Off
mbstring.detect_order = auto
mbstring.substitute_character = none;
mbstring.func_overload = 0
mbstring.strict_encoding = Off



以上でLiteSpeed+Mysql+PHPの動作環境が整いました。上記以外にもLiteSpeedの詳細設定や、Mysqlの動作設定・PHPのライブラリ関連の設定等が必要になってきますが、それらについてはまた次の機会に。
Posted by: simpraight at 2006/11/13 00:09:01 | Tags: [osx] [環境] [インストールメモ] | Comments:3 | Trackbacks:0

*Trackback

このエントリへのトラックバックURL:

*Comments

  • J'apprécie tous vos tordait sur ce sujet intéressant
    Je sais que cela , si hors sujet mais je suis à la recherche de démarrer ma propre blog et a été curieux de ce que tout est nécessaire pour se mettre en place ? Je suppose d'avoir un blog comme le vôtre pourrait coûter une somme rondelette ? Je ne suis pas calée en web donc je ne suis pas sûr à 100% . Des astuces ou conseils seraient grandement appréciés . Appréciez-
    Posted by: loans till payday at: 2012/01/12 10:35:23  [link]
  • opera mine
    portal скачать opera mini для китайских телефонов качать опера
    <a href=http://nnlddee.hostingsociety.com/opera-mini-for-6300.html>opera mini for 6300</a>
    free symbian
    скачать opera 12 rus
    скачать opera бесплатно без смс
    опера 9.5
    opera mini 3 advanced

    <a href=http://udgvcye.hostingsociety.com/opera-dlja-5230.html>опера для 5230</a>
    Posted by: rearserot at: 2012/02/12 22:48:24  [link]
  • opera for pc
    opera для телефона скачать скачать интернет браузер opera скачать бесплатно новую версию оперы
    <a href=http://qlbzppx.hostingsociety.com/the-phantom-of-the-opera-skachatj.html>the phantom of the opera скачать</a>
    opera для компьютера скачать бесплатно
    opera mini скачать бесплатно для nokia 6300
    fast internet browsers
    windows mobile downloads
    ult crfxfnm

    <a href=http://nnlddee.hostingsociety.com/skachatj-na-telefon-operu-mini.html>скачать на телефон оперу мини</a>
    Posted by: rearserot at: 2012/02/13 04:51:39  [link]
TITLE:
NAME:
URL/Email:
Comments: