CodeIgniterの学習 67 - Zend ServerをLinodeのVPS上に入れてCodeIgniterを動かしてみた。VPSで遊ぶ -その4

今日はいろいろてんこ盛りなエントリー。


この前借りた linodefremontVPS(Linode360)に、
このあいだ出た Zend Server を突っ込んでみた。

んでその上にこの前作った ヤフーの画像検索api形態素解析apiの画像検索お遊びアプリをのせてみた。
ちなみにCodeIgniterのログ機能をZend_Logに置き換えている。


(CodeIgniterの学習 63 - ヤフーの画像検索api形態素解析apiを組み合わせてお遊びアプリを作る-その8(現在のコード完成度100%) http://d.hatena.ne.jp/dix3/20090114/1231941174)


linoode - http://www.linode.com/
zend - http://www.zend.com/



実験URL(VPS上)

実験URLはここ: http://pizw.com/



なぜか4文字ドメイン com , org , net , biz , infoをセットで持っている俺。以前放出されてたのを捕獲しておいた。


動作画面イメージ

画面はこんな感じ(firefox以外だと崩れるかも。):


メモリ360MBしかないから、あまりいじめないでね。
(画像はyimg.comへのimageタグなので、転送量は大したこと無いけど。)

微妙に遅いのはヤフーのapi側への接続ウェイトをわざと入れているのと、その反応待ちが主原因です。
キャッシュにヒットしている場合は反応は速いと思う。


あといろいろ弄って調教中だから不通状態もあるかも。
穴があったら入りたいのでご指摘ください。


VPSにZend Serverをインストールしたメモ

まだベータ版らしいので、元に戻すかも。

ちなみに、テスト環境でやらないとたぶん悲しいことになるので注意してね。

(いろいろインストール+php周りのパッケージが削除されるから)
apache2+lighthttpd(管理画面用)+php5+ZendFrameworkてんこ盛り な構成みたい。


マニュアル見れば分かるけど一応書いておく。

1)マニュアルのダウンロード

http://www.zend.com/en/products/server/downloads-all

で、ダウンロードを進めると、pdfのZendServer-CE-Installation-Guide_4.0_Beta なるものがダウンロード出来る。


このPDFを読み進めてみると、Ubuntu君の場合は、aptitudeで一発インストール出来るらしい。

以下全部ルート権限で作業。


2) /etc/apt/sources.listの編集

最終行に、 deb http://repos.zend.com/deb/ce ce non-free を追加



3)レポジトリのパブリックキーを追加

wget http://repos.zend.com/deb/zend.key -O- |apt-key add -


4)aptitude update の実行


5)zend-server-ceのインストール 実行

aptitude install php5-extra-extensions-zend-ce zend-ce


php5-extra-extensions-zend-ce の方に mbstring.soとかが有るので、この2つ。


mysqlのインストールとか、httpd.confとかは眠いので説明省略。
(80番ポートを開ける ufw allow http も忘れずに。)
(どうせ試す人は好き者だろうし、自分で調べるだろうからいいよね。)



Zend Serverの管理画面

インストールが終わると、 http://localhost:10081 又は、https://localhost:10082 でZend Serverの管理画面に繋げられる。

(管理画面へはputtysshポートフォワーディング経由で接続)


(以下画面べたべた)
まだ細かく見てないけどなんかかっこいいよ。
全体的にColdFusion Administratorっぽいね。




始めに管理画面のパスワード決めろってさ。






ダッシュボードカコイイ






コンポーネントの使用制御と、設定が出来る。






extensionの使用制御と、設定が出来る。使わなそうなのはここでOFF出来る。

内部で
/usr/local/zend/etc/php.iniとか、/usr/local/zend/etc/ext.d/*.ini とかを書き換えて、設定しているようだ。






ログ確認画面。

ログは、/usr/local/zend/var/log 以下にある。(CodeIgnierのログは別)






php.iniの内容も、Directivesで設定出来る。






次回からはこんなログイン画面。


CodeIgniterで作ったお遊びアプリを設置する。

詳しくは眠いので省略。

ドキュメントルートは /var/www/
だったので、
ここに index.phpcssファイルとかだけ置いて、
systemとapplicationディレクトリはドキュメントルート外に追い出している。



CodeIgniter上のZend Frameworkを/usr/local/zend/share/ZendFramework以下を使うようにする。

以前のエントリー
CodeIgniterの学習 43 - ログ出力をZend_Logに置き換える http://d.hatena.ne.jp/dix3/20081117/1226870236
の時に、

ドキュメントルート/index.php内で、

ini_set( 'include_path', APPPATH . 'my_classes/' );

として、
application/my_classes/Zend/以下のZend Framework一式を使っていたが、

今回ZendServerでそれが不要になるのでこの記述を外し、
ついでにapplication/my_classes/Zend/ 以下は削除した。

これでZend Frameworkを入れ替える手間が減るぜい。


動かしてみる。

うん普通にうごくっぽい。以外にあっさり ZendServerに乗っかった。


これでこそZend Frameworkとも融合できるってもんよ。
早く正式版にならないかなー。



dpkg -l |grep zend してみる

こんな感じ (community edition)
通常のパッケージ末尾に -zend-ce付きのものに置き換わる。(インストール場所も基本 /usr/local/zend/以下になる)

モリモリインストールされてしまうが、不要なものは管理画面側で不使用にしてロードしないので一応問題ない。

# dpkg -l|grep zend

ii  libapache2-mod-php5-zend-ce       5.2.8+b56                     server-side, HTML-embedded scripting languag
ii  libframework1-zend-ce             1.5.2-1+b26                   Zend framework's library portion [does not i
ii  libmssql-zend                     1.0-1+b18                     Needed shared libraries in order for the PHP
ii  liboci-zend                       1.0-1+b4                      Needed shared libraries in order for the PHP
ii  lighttpd-zend-ce                  1.4.18-1+b54                  dedicated lighttpd server for Zend Community
ii  php-bcmath-zend-ce                5.2.8+b19                     PHP extension for arbitrary precision mathem
ii  php-bz2-zend-ce                   5.2.8+b20                     PHP bz2 extension.
ii  php-calendar-zend-ce              5.2.8+b19                     The calendar PHP extension presents a series
ii  php-ctype-zend-ce                 5.2.8+b19                     PHP ctype extension.
ii  php-curl-zend-ce                  5.2.8+b20                     PHP supports libcurl, a library created by D
ii  php-data-cache-zend-ce            4.0.32+b51                    Zend's extension for PHP data caching and pa
ii  php-debugger-zend-ce              5.2.17+b43                    Zend’s extension for server side debugging
ii  php-dev-zend-ce                   5.2.8+b27                     Zend Server development package. Includes PH
ii  php-exif-zend-ce                  5.2.8+b17                     The PHP exif extension enables you to work w
ii  php-fcgi-zend-ce                  5.2.8+b34                     PHP FastCGI binary used by the Zend Server's
ii  php-fileinfo-zend-ce              5.2.8+b16                     PHP fileinfo extension.
ii  php-ftp-zend-ce                   5.2.8+b17                     PHP extension that implements client access
ii  php-gd-zend-ce                    5.2.8+b19                     PHP GD extension.
ii  php-gettext-zend-ce               5.2.8+b17                     PHP extension that implements an NLS (Native
ii  php-gmp-zend-ce                   5.2.8+b18                     PHP extension that enables work with arbitra
ii  php-iconv-zend-ce                 5.2.8+b18                     This PHP extension provides an interface to
ii  php-imagick-zend-ce               5.2.8+b3                      Imagick is a native php extension to create
ii  php-imap-zend-ce                  5.2.8+b18                     PHP extension that enables operation with th
ii  php-intl-zend-ce                  5.2.8+b4                      The internationalization extension (Intl) is
ii  php-json-zend-ce                  5.2.8+b18                     This PHP extension implements the » JavaScr
ii  php-ldap-zend-ce                  5.2.8+b18                     LDAP PHP extension. LDAP is the Lightweight
ii  php-mbstring-zend-ce              5.2.8+b17                     The mbstring PHP extension provides multibyt
ii  php-mcrypt-zend-ce                5.2.8+b18                     This PHP extension provides an interface to
ii  php-memcache-zend-ce              5.2.8+b17                     The PHP Memcache extension provides handy pr
ii  php-mhash-zend-ce                 5.2.8+b18                     PHP extension for mhash. Mhash can be used t
ii  php-mime-magic-zend-ce            5.2.8+b17                     PHP mime_magic extension.
ii  php-ming-zend-ce                  5.2.8+b19                     PHP extension for Ming.
ii  php-mssql-zend-ce                 5.2.8+b18                     PHP extension that allows access MS SQL Serv
ii  php-mysql-zend-ce                 5.2.8+b22                     PHP extension that allows access to MySQL da
ii  php-mysqli-zend-ce                5.2.8+b22                     The mysqli PHP extension allows access to th
ii  php-oci8-zend-ce                  5.2.8+b23                     PHP extension for OCI8. Allows access to Ora
ii  php-odbc-zend-ce                  5.2.8+b17                     PHP odbc extension.
ii  php-optimizer-plus-zend-ce        4.0.48+b56                    Zend’s extension for using opcode caching
ii  php-pcntl-zend-ce                 5.2.8+b17                     Process Control support for PHP. Implements
ii  php-pdo-mysql-zend-ce             5.2.8+b20                     PHP extension that implements the PHP Data O
ii  php-pdo-oci-zend-ce               5.2.8+b28                     PHP pdo-oci extension.
ii  php-pdo-pgsql-zend-ce             5.2.8+b21                     PHP extension that implements the PHP Data O
ii  php-pgsql-zend-ce                 5.2.8+b19                     PHP extension for PostgreSQL. PostgreSQL dat
ii  php-posix-zend-ce                 5.2.8+b17                     PHP extension that provides an interface to
ii  php-shmop-zend-ce                 5.2.8+b17                     PHP extension that allows PHP to read, write
ii  php-soap-zend-ce                  5.2.8+b17                     The SOAP PHP extension can be used to write
ii  php-sockets-zend-ce               5.2.8+b19                     PHP sockets extension.
ii  php-sqlite-zend-ce                5.2.8+b17                     PHP extension for the SQLite Embeddable SQL
ii  php-sysvmsg-zend-ce               5.2.8+b16                     The sysvmsg PHP extension.
ii  php-sysvsem-zend-ce               5.2.8+b16                     PHP extension that provides semaphore functi
ii  php-sysvshm-zend-ce               5.2.8+b16                     PHP extension for Sys V shared memory.
ii  php-tidy-zend-ce                  5.2.8+b23                     PHP extension for the Tidy HTML clean and re
ii  php-tokenizer-zend-ce             5.2.8+b16                     PHP extension that provides an interface to
ii  php-wddx-zend-ce                  5.2.8+b17                     PHP wddx extension.
ii  php-xmlreader-zend-ce             5.2.8+b17                     The XMLReader PHP extension is an XML Pull p
ii  php-xmlrpc-zend-ce                5.2.8+b19                     PHP extension that enables writing XML-RPC s
ii  php-xmlwriter-zend-ce             5.2.8+b17                     PHP XMLWriter extension wrapper around the l
ii  php-xsl-zend-ce                   5.2.8+b17                     The XSL PHP extension implements the XSL sta
ii  php-zem-zend-ce                   5.1.53+b41                    Zend Extension Manager. Used for loading Zen
ii  php-zendutils-zend-ce             1.0.39+b46                    PHP extension for use of the Zend Server Com
ii  php-zip-zend-ce                   5.2.8+b15                     This PHP extension enables you to transparen
ii  php5-common-extensions-zend-ce    4.0.0-1+b58                   PHP commonly used extensions.
ii  php5-extra-extensions-zend-ce     4.0.0-1+b58                   Additional PHP extensions.
ii  php5-unix-extensions-zend-ce      4.0.0-1+b58                   PHP Sys V and POSIX extensions.
ii  zend-base-ce                      1.0.0-1+b60                   Basic files needed for Zend Server Community
ii  zend-ce                           4.0.0-1+b58                   Zend web application server package.
ii  zend-ce-doc                       4.0.2+b15                     Zend CE documentation.
ii  zend-extensions-ce                4.0.0-1+b58                   Zend Server modules.
ii  zend-framework-ce                 1.7.4+b30                     Zend's PHP Framework.
ii  zend-gui-ce                       4.0.5+b127                    Zend Server Community Edition’s Administra


とりあえず今日はここまで。
ベンチマーク比較とかは気が向いたらやってみる。



実験サイトの http://pizw.com/ は、

対象サイトをはてな限定+エロイ写真は検索できないようにしているので、
変なキーワードとか個人名とかは入れないでね。みんなの最新検索キーワードに残しちゃうから。

(まずかったら出ないようにするから良いけど)

関連エントリー
VPSで遊ぶ -その1 LinodeでVPS借りた。
VPSで遊ぶ -その2 もう一台Linodeで借りた。
VPSで遊ぶ -その3 Linodeのアトランタ(内陸部)とフレモント(西海岸)のping速度比較 - やっぱり西海岸は快適
VPSで遊ぶ -その5 Linode制御用のiphoneアプリを入れてみる。何処でもサーバ状況確認+再起動おk+鯖作成・DNS管理まで可能
VPSで遊ぶ -その6 LinodeとServersMan VPSとさくらのVPSとさくら専用鯖と自宅鯖との比較(秋のVPS&自宅鯖unixbench一人祭り結果 詳細)
VPSで遊ぶ -その7 LinodeとServersMan VPSとさくらのVPSの転送速度の簡易テスト結果