LAMP開発環境構築に苦戦中(その1) -- Zend Debugger インストール
なにはともあれLAMP開発環境構築のお勉強を始めました
目指す環境はこんな感じ
上手く行ったもの
まずは Virtual Box と Ubuntu は入れて、IME は使えるようにした
Java SDK 1.7.0_05 をインストールした
(参考サイト) http://askubuntu.com/questions/55848/how-do-i-install-oracle-java-jdk-7
LAMP をインストールした
(参考サイト) http://www.unixmen.com/install-lamp-with-1-command-in-ubuntu-1010-maverick-meerkat/
Eclipse for PHP Developers をインストールした
(ダウンロードしたサイト) http://www.eclipse.org/downloads/packages/eclipse-php-developers/heliosr
Zend Eclipse PDT / PDT 3.0.2 w/Eclipse Indigo (64 bit) をインストールした
(ダウンロードしたサイト) http://www.zend.com/en/community/pdt/downloads
Zend Debugger インストールに苦戦中
一次ソースらしき情報
次に Zend Debugger のインストールを試みたが、うまく行かない
なかなか Zend Debugger の一次ソースらしき情報に辿り着けなかったが、
やっとそれらしいのに引っかかった
(参考サイト)
Installing Zend Debugger on Linux
http://forums.zend.com/viewtopic.php?f=59&t=962#p4190
zend debugger ダウンロード
まずはこちらのサイトから
http://www.zend.com/community/pdt/downloads
Studio Web Debugger 20110410 (64 bit)
をダウンロード
解凍してできる 5_3_x_comp ディレクトリにあったやつを、下の位置に配置。
# ls -l /opt/Zend/php-5.3.x/ZendDebugger.so
- rwxr-xr-x 1 root root 220452 2月 13 2011 /opt/Zend/php-5.3.x/ZendDebugger.so
共通で使う設定
どうも最近の Linux distribution では apache2 用と、 php cli 用の2つの php.ini が用意されているのが多いそうだ。
下が自分の環境の .ini がある /etc/php5 配下の様子
# pwd ; ls -R /etc/php5 .: apache2 cli conf.d ./apache2: conf.d php.ini ./cli: conf.d php.ini ./conf.d: gd.ini mcrypt.ini mysqli.ini mysql.ini pdo.ini pdo_mysql.ini
ここで apache2 でも cli でも共通で使いたい設定は、 conf.d の下に、 .ini を作って置けばいいらしい。
zend.ini の内容
その conf.d に zend.ini を置く。
内容はこんな感じ。しかし「;」のところは元は「#」だった。参考サイトがそうだったから。
# pwd ; cat zend.ini /etc/php5/conf.d ; The section name is optional, but it's always a good idea to add it, ; especially if you are not using a separate file [Zend] ; This directive needs the full path to the Zend Debugger binary zend_extension =/opt/Zend/php-5.3.x/ZendDebugger.so ; This directive allows Zend Debugger to start a debug session with: ; 127.0.0.1/32 – Zend Studio on the same computer ; 192.168.0.1/32 – Zend Studio on a computer with IP address 192.168.0.1 ; 10.0.0.0/8 – Zend Studio on any computer with IP starting with 10. zend_debugger.allow_hosts=127.0.0.1/32,192.168.0.1/32,10.0.0.0/8 ; This directive allows Zend Debugger to expose itself ; upon request (this is used in some service functionality). ; The possible options are: ; never – do not expose (default) ; always – expose to whoever wants to know ; allowed_hosts – expose only if the request comes from an IP listed above zend_debugger.expose_remotely=always
共通で使う設定が読み込まれたことの確認
設定してみたらそれが読み込まれているかを確認したい。
それは phpinfo() をみて確認できた。
設定後、apache2 は下の要領で再起動している。
#sudo /etc/init.d/apache2 restart
Scan this dir for additional .ini files の欄で追加で読み込まれる、 .ini のディレクトリが分かる。
Additional .ini files parsedの欄で php に解析された .ini が分かる。
その欄の最後に追加した /etc/php5/apache2/conf.d/zend.ini があるので読み込まれているのは間違いない。
zend.ini解析のエラーとログ確認
Zend Debugger が読み込まれると、phpinfo の Zend Engine 欄に、その名前がでるらしいが見ると出ていない。
そこで zend.ini が読み込まれたときの log を確認したい。
どうも php を何も設定しないと、apache2 のログの方にでるらしい。
自分の環境では下だった。
/var/log/apache2/error.log
さて中身を見てみると、主に下のような2つのログがでていた。
Failed loading /opt/Zend/php-5.3.x/ZendDebugger.so: libssl.so.0.9.8: cannot open shared object file: No such file or directory PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/apache2/conf.d/zend.ini on line 1 in Unknown on line 0
「PHP Deprecated: Comments~」の方は、zend.ini の 「#」を「;」に置換したら直ったようだ。
「~libssl.so.0.9.8~」の方をこれから調べようというところ。
環境作るの難しいな。 もしかしたら、aptana studio3 だったらもっと簡単だったりして。
libssl.so.0.9.8インストール
気を取り直して apt-get でインストールできるか調べてみるとできそうだった。
$ apt-cache search libssl libssl-dev - SSL development libraries, header files and documentation libssl-doc - SSL development documentation documentation libssl1.0.0 - SSL shared libraries libssl1.0.0-dbg - Symbol tables for libssl and libcrypto dcmtk - OFFIS DICOM toolkit command line utilities libcherokee-mod-libssl - Cherokee web server - SSL crypto functions plugin libdcmtk2 - OFFIS DICOM toolkit runtime libraries libdcmtk2-dev - OFFIS DICOM toolkit development libraries and headers libssl-ocaml - OCaml bindings for OpenSSL (runtime) libssl-ocaml-dev - OCaml bindings for OpenSSL libssl0.9.8 - SSL shared libraries libssl0.9.8-dbg - Symbol tables for libssl and libcrypto libsslcommon2 - enterprise messaging system - common SSL libraries libsslcommon2-dev - enterprise messaging system - common SSL development files
早速、インストール
$ sudo apt-get install libssl0.9.8 Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: libssl0.9.8 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 861 kB of archives. After this operation, 2,391 kB of additional disk space will be used. Get:1 http://jp.archive.ubuntu.com/ubuntu/ precise-updates/universe libssl0.9.8 amd64 0.9.8o-7ubuntu3.1 [861 kB] Fetched 861 kB in 1s (622 kB/s) Preconfiguring packages ... Selecting previously unselected package libssl0.9.8. (Reading database ... 174665 files and directories currently installed.) Unpacking libssl0.9.8 (from .../libssl0.9.8_0.9.8o-7ubuntu3.1_amd64.deb) ... Setting up libssl0.9.8 (0.9.8o-7ubuntu3.1) ... Processing triggers for libc-bin ... ldconfig deferred processing now taking place
下にインストールされたようなので
$ ls -l /usr/lib/x86_64-linux-gnu/libssl.so.0.9.8 lrwxrwxrwx 1 root root 37 4月 25 00:27 /usr/lib/x86_64-linux-gnu/libssl.so.0.9.8 -> /lib/x86_64-linux-gnu/libssl.so.0.9.8
/usr/lib へシンボリックリンクをはり
# ln -s /lib/x86_64-linux-gnu/libssl.so.0.9.8 /usr/lib/libssl.so.0.9.8 # ls -l /usr/lib/libssl.so.0.9.8 lrwxrwxrwx 1 root root 37 8月 12 22:25 /usr/lib/libssl.so.0.9.8 -> /lib/x86_64-linux-gnu/libssl.so.0.9.8
再び apache2 を再起動した。
殺した方のプロセスは再び、libssl が無いってログが出るが、
立ち上げた方のログはエラーは出てない模様。
[Sun Aug 12 22:26:11 2012] [notice] caught SIGTERM, shutting down Failed loading /opt/Zend/php-5.3.x/ZendDebugger.so: libssl.so.0.9.8: cannot open shared object file: No such file or directory [Sun Aug 12 22:26:12 2012] [notice] Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.2 with Suhosin-Patch configured -- resuming normal operations
そして phpinfo を見ると、今度は「with Zend Debugger~」の行が確認できる。
やっと入った。
これ難しいな。