8
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CentOS6.3でPHP5.5をソースからインストール

Posted at

CentOS6.3でPHP5.5をソースからインストール

環境

# uname -a
Linux ttakahashi 2.6.32-279.el6.x86_64 #1 SMP Fri Jun 22 12:19:21 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
# cat /etc/redhat-release 
CentOS release 6.3 (Final)

前提

Apache2.4.6をインストール済み

PHPのインストール

1.PHPソースファイルのダウンロード

# cd /usr/local/src/
# wget http://us2.php.net/get/php-5.5.5.tar.gz/from/jp1.php.net/mirror

2.PHPのインストール

# tar xvfz php-5.5.5.tar.gz
# cd php-5.5.5
# ./configure --with-apxs2=/usr/local/apache2/bin/apxs
configure: error: xml2-config not found. Please check your libxml2 installation. ← エラーが出た

3.libxml2ソースファイルのダウンロード&インストール

# cd /usr/local/src/
# wget ftp://xmlsoft.org/libxml2/libxml2-2.9.1.tar.gz
# tar xvfz libxml2-2.9.1.tar.gz
# cd libxml2-2.9.1
# ./configure
# make
# make install

4.PHPのインストール再実行

# cd php-5.5.5
# ./configure --with-apxs2=/usr/local/apache2/bin/apxs
 →今度は成功
# make
# make install

5.動作確認

# cd /usr/local/apache2/htdocs
# vi phpinfo.php
<?php
phpinfo();
?>
# curl http://192.168.155.70/phpinfo.php
<?php
phpinfo();
?>
↑ 文字列として返ってきてしまった・・・

6.PHP利用のためのApache設定(http.conf設定)

1.モジュールの追加(新規追加)

/usr/local/httpd/conf/httpd.conf
147行目 LoadModule php5_module        modules/libphp5.so

2.拡張子の登録(新規追加)

/usr/local/httpd/conf/httpd.conf
376行目     AddType application/x-httpd-php .php
377行目     AddType application/x-httpd-php-source .phps

3.php.iniの配置場所の指定(PHPIniDir)(新規追加)

/usr/local/httpd/conf/httpd.conf
505行目 PHPIniDir "/usr/local/lib/php/php.ini"

4.Apache再起動

# /usr/local/apache2/bin/apachectl restart

7.動作確認

# curl http://xxx.xxx.xxx.xxx/phpinfo.php
8
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?