いまさらながらPHPのインストールでしくじることがあったのでメモ。
まずPHPをインストールする。
# wget http://jp.php.net/get/php-5.3.8.tar.gz/from/us.php.net/mirror # tar xvfz php-5.3.8.tar.gz # ./configure --enable-mbstring --with-apxs2 --with-mysql --with-gd --with-zlib --with-jpeg-dir --with-tsm-pthreads --enable-maintainer-zts --cache-file=../config.cache # make # make install # which php /usr/local/bin/php # php -v PHP 5.3.8 (cli) (built: Oct 27 2011 11:47:09) Copyright (c) 1997-2011 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
apacheとの連携
# vi /etc/httpd/conf/httpd.conf LoadModule php5_module /usr/lib/httpd/modules/libphp5.so DirectoryIndex index.html index.html.var index.php AddType application/x-httpd-php .php # /etc/rc.d/init.d/httpd configtest # /etc/rc.d/init.d/httpd restart
正常にphpinfo()できればおk。
【追記】
64bit版の場合、./configureのオプションがちょっと変わります。
さくらVPSが64bit版だったっぽくちょっと悩みました。
オプションに “–with-libdir=lib64″ を追加してください。
./configure --enable-mbstring --with-apxs2 --with-mysql --with-gd --with-zlib --with-libdir=lib64 --with-pear --with-gd --enable-maintainer-zts --cache-file=../config.cache
【追記2】
Curlを使う場合。
./configure --enable-mbstring --with-apxs2 --with-mysql --with-gd --with-zlib --with-libdir=lib64 --with-pear --with-gd --with-curl --enable-sockets --enable-maintainer-zts --cache-file=../config.cache











