[メモ]CentOS5.6のPHPをソース版に入れ替える
CentOS5.6にデフォルトでインストールされるPHPではなく、
必要最低限(?)のモジュールのみでコンパイルしたPHPに入れ替える必要があったので、
その手順をメモしておく。
【作業前バージョン】5.1.6
【作業後バージョン】5.2.17
■現状確認
# rpm -qa |grep php php-5.1.6-27.el5_5.3 php-common-5.1.6-27.el5_5.3 php-cli-5.1.6-27.el5_5.3 php-ldap-5.1.6-27.el5_5.3
■デフォルトのPHPをアンインストール
# rpm -qa |grep php | xargs rpm -e
■必須パッケージのインストール
yum install libjpeg\* yum install libpng\* yum install libc-client\* yum install libmcrypt\* yum install mysql-devel yum install php-pdo php-common
■PHPのソースをダウンロード
cd /usr/local/src wget http://jp.php.net/get/php-5.2.17.tar.gz/from/this/mirror tar zxvf php-5.2.17.tar.gz cd php-5.2.17
■コンパイル
./configure \ --prefix=/usr/local \ --with-libdir=lib64 \ --with-mysql=/usr/bin/mysql \ --with-openssl \ --with-pear \ --enable-mbstring \ --enable-mbregex \ --enable-zend-multibyte \ --enable-sockets \ --with-apxs2=/usr/sbin/apxs \ --with-gd \ --with-zlib-dir=/usr \ --with-jpeg-dir=/usr \ --enable-ftp \ --enable-zip \ --with-iconv \ --with-imap \ --enable-mbstring \ --with-gd \ --enable-xmlreader \ --enable-xmlwriter \ --with-kerberos \ --with-imap-ssl \ --with-mcrypt \ --with-pdo-mysql=/usr/bin/mysql \ --with-mysqli=/usr/bin/mysql_config \ --enable-embedded-mysqli=/usr/bin/mysql \ --enable-calendar \ --with-curl make make test make install
■php.iniの入れ替え
mv /etc/php.ini /etc/php.ini.20110903 cp php.ini-recommended /usr/local/lib/php.ini
■php.confの作成
cd /etc/httpd/conf.d vi php.conf # # PHP is an HTML-embedded scripting language which attempts to make it # easy for developers to write dynamically generated webpages. # LoadModule php5_module modules/libphp5.so # # Cause the PHP interpreter to handle files with a .php extension. # AddHandler php5-script .php AddType text/html .php # # Add index.php to the list of files that will be served as directory # indexes. # DirectoryIndex index.php # # Uncomment the following line to allow PHP to pretty-print .phps # files as PHP source code: # #AddType application/x-httpd-php-source .phps
The following two tabs change content below.

しゃちょー
有限会社こだまシステム社長。18歳の時からIT業界で働く。趣味はモータースポーツ。マイブームはダイエット。

最新記事 by しゃちょー (全て見る)
- 企業が間違う働き方改革 - 2019年6月26日
- ウンベラータに新しい芽が出てきたよ! - 2019年6月25日
- 【お金】と【ありがとう】についての大事な話。 - 2018年3月16日