2012年1月31日火曜日

symfonyはじめました-symfonyのインストール

Getting Started with symfony
symfonyのインストール


プロジェクト用のディレクトリを作る。 $ mkdir -p /home/sfproject
$ cd /home/sfproject
symfonyのライブラリのファイルをぶっこむディレクトリを作る $ mkdir -p lib/vendor ここからダウンロードしてきて展開する。 $ cd lib/vendor
$ tar zxpf symfony-1.4.16.tgz
$ mv symfony-1.4.16 symfony
$ rm symfony-1.4.16.tgz
symfonyのバージョンを表示するコマンドを使うことでsymfonyが正しくインストールされていることを確認 $ cd ../..
$ php lib/vendor/symfony/data/bin/symfony -V
終わり。簡単ですね。

おまけ $ php lib/vendor/symfony/data/bin/symfony で色々見れる。

ServerQueenのVPSにPHP5.3.9をソースからインストール

CentOS5.7でPHPのバージョンが5.2.17でしたとさ。
rpmでインストールされてました。
これを5.3にしたかった。
とりあえずまずはソースをダウンロード
http://www.php.net/downloads.php
最新安定版の5.3.9をダウンロードしました。

apacheを停止(しなくてもよかったのかもしれないが)

sudo service httpd stop ソースを解凍してインストールを試みる configureのオプションはすでにインストールされていたPHPのphpinfoを見てそれっぽいところをいじった。 tar jxf php-5.3.9.tar.bz2
cd php-5.3.9
./configure --host=i686-redhat-linux-gnu --build=i686-redhat-linux-gnu --target=i386-redhat-linux --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --cache-file=../config.cache --with-libdir=lib --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --disable-debug --with-pic --disable-rpath --with-bz2 --with-curl --with-exec-dir=/usr/bin --with-freetype-dir=/usr --with-png-dir=/usr --enable-gd-native-ttf --with-gettext --with-gmp --with-iconv --with-jpeg-dir=/usr --with-openssl --with-zlib --with-layout=GNU --enable-exif --enable-ftp --disable-magic-quotes --enable-sockets --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-wddx --with-kerberos --enable-ucd-snmp-hack --enable-shmop --enable-calendar --with-libxml-dir=/usr --enable-xml --with-apxs2=/usr/sbin/apxs --with-mysql --with-gd --enable-xmlreader --enable-xmlwriter --enable-json --enable-mbstring --enable-mbregex --with-xsl=/usr/lib
make
make install
で、確認 php -v
PHP 5.3.9 (cli) (built: Jan 31 2012 02:21:02)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
というわけで、CLI版は問題なさそうだったんだけど、モジュール版(?)のphpinfoを見てみたらバージョン変わってなくて、しばしハマることになる。
グーグル先生の話ではlibphp5.soがバグで生成されないとのことだそうで
下記のサイトなどを参考にlibphp5.soを生成してからインストールという手順でいくことにした。
PHP5インストールでのlibphp5.soバグ対応
すると今度は
error: Could not find pcre.h in /usr
とかなんとか言い出した。
こちらを参考にしたが、すでにPCRE自体はインストールされていた。
rpm -qs pcre
インストール先を確認して、パスを指定する。
しかし上手くいかないのでいっそ何も指定せずにインストールしたらうまくいった・・・。
参考
で、libphp5.soが生成できて、もう一度コンフィグ作りなおして、インストールして終わりだったと思う。 すでにうろ覚えなのでこの記事の正確性は保証できません!
はい、おつ。