PHP5をインストールしているCentOSで、PHP7も使用したい

プログラミング言語PHP

概要

 状態:調査中  閲覧数:1,872  投稿日:2016-01-16  更新日:2016-03-10
最終的に正常動作確認出来ていません






phpenv
・複数バージョンのPHPを管理するツール
・PHPのバージョンをフォルダごとに分けることが可能

PHP のバージョンを切り替えるには、phpenv global コマンドを実行
・これでphp のバージョンが 7.0.2 になる
$ phpenv global 7.0.2

デフォルトの PHPバージョンへ戻すには system を指定
$ phpenv global system


グローバル or ローカル


全てのディレクトリで有効にする場合
phpenv global [version]

現在のディレクトリのみで有効にする場合
phpenv local [version]


PHP5をインストールしているCentOSで、PHP7も使用したい

現状確認 / phpenvインストール

 閲覧数:226 投稿日:2016-01-16 更新日:2016-01-16 

現状確認


$ phpenv install -l
-bash: phpenv: コマンドが見つかりません

$ sudo -s
[sudo] password for ★★: 

# phpenv install -l
bash: phpenv: コマンドが見つかりません

# phpenv versions
bash: phpenv: コマンドが見つかりません

# php -v
PHP 5.4.32 (cli) (built: Aug 21 2014 07:33:35) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies

$ git --version
git version 1.7.1


.bashrc

▼/home/★★/.bashrc

$ pwd
/home/★★

$ ls -a
.              .composer    .mysql_history  .ssh                               casperjs              phantomjs
..             .config      .node-gyp       .subversion                        ls.txt                php-mecab-0.5.0
.bash_history  .dbshell     .nodebrew       .v8flags.3.14.5.9.★★.json  mecab-0.996           php-mecab-0.5.0.tgz
.bash_logout   .gem         .npm            .viminfo                           mecab-0.996.tar.gz    repos
.bash_profile  .lesshst     .phpenv         .zprofile                          mecab-0.996.tar.gz.1  tmp
.bashrc        .local       .pki            .zshrc                             myapp
.cache         .mongorc.js  .rvm            bower_configuration                nodebrew





インストール


$ mkdir -p repos/git
$ cd repos/git
phpenvをダウンロード
$ git clone https://github.com/CHH/phpenv.git
Initialized empty Git repository in /home/★★/repos/git/phpenv/.git/
remote: Counting objects: 399, done.
remote: Total 399 (delta 0), reused 0 (delta 0), pack-reused 399
Receiving objects: 100% (399/399), 69.87 KiB, done.
Resolving deltas: 100% (162/162), done.

下記ディレクトリへ移動
$ cd phpenv/bin
shファイル実行
・phpenvインストール開始
$ ./phpenv-install.sh
Installing phpenv in /home/★★/.phpenv
remote: Counting objects: 2484, done.
remote: Total 2484 (delta 0), reused 0 (delta 0), pack-reused 2484
Receiving objects: 100% (2484/2484), 443.61 KiB | 257 KiB/s, done.
Resolving deltas: 100% (1566/1566), done.
Success.

export PATH="/home/★★/.phpenv/bin:$PATH"
eval "$(phpenv init -)"

Add above line at the end of your ~/.bashrc and restart your shell to use phpenv.


bahsrcにパスを追加
・vim立ち上げ
$ vim ~/.bashrc
・下記コピペ
・:wqで保存
export PATH="/home/★★/.phpenv/bin:$PATH"
eval "$(phpenv init -)"

変更内容を即反映
$ source ~/.bashrc


phpenvインストール確認

 閲覧数:311 投稿日:2016-01-16 更新日:2016-01-16 

問題発生


インストール可能なPHPバージョン一覧が表示されない
$ phpenv install -l
rbenv: no such command `install'

$ phpenv versions
* system (set by /home/★★/.phpenv/version)

$ phpenv
rbenv 1.0.0-14-gc388331
Usage: rbenv <command> [<args>]

Some useful rbenv commands are:
  commands    List all available rbenv commands
  local       Set or show the local application-specific Ruby version
  global      Set or show the global Ruby version
  shell       Set or show the shell-specific Ruby version
  rehash      Rehash rbenv shims (run this after installing executables)
  version     Show the current Ruby version and its origin
  versions    List all Ruby versions available to rbenv
  which       Display the full path to an executable
  whence      List all Ruby versions that contain the given executable

See `rbenv help <command>' for information on a specific command.
For full documentation, see: https://github.com/rbenv/rbenv#readme

$ rbenv commands
--version
commands
completions
exec
global
help
hooks
init
local
prefix
rehash
root
shell
shims
version
version-file
version-file-read
version-file-write
version-name
version-origin
versions
whence
which


$ rbenv -v
rbenv 1.0.0-14-gc388331


$ which phpenv
~/.phpenv/bin/phpenv


$ phpenv -v
rbenv 1.0.0-14-gc388331



最終的に


php-buildインストール後でなければ確認できないことが判明
・php-build を入れると phpenv install コマンドが使えるようになる


phpenvで複数のPHPのバージョンを管理する

php-buildインストール

 閲覧数:216 投稿日:2016-01-16 更新日:2016-01-16 
phpenv の plugin として php-build を入れる
$ git clone https://github.com/CHH/php-build.git ~/.phpenv/plugins/php-build
Initialized empty Git repository in /home/dotinstall/.phpenv/plugins/php-build/.git/
remote: Counting objects: 4133, done.
remote: Total 4133 (delta 0), reused 0 (delta 0), pack-reused 4133
Receiving objects: 100% (4133/4133), 580.49 KiB | 332 KiB/s, done.
Resolving deltas: 100% (2505/2505), done.

$ phpenv install --list
usage: phpenv install [--ini|-i <environment>] VERSION
      phpenv install [--ini|-i <environment>] /path/to/definition

Available versions:
5.2.17
5.3.2
5.3.3
5.3.6
5.3.8
5.3.9
5.3.10
5.3.11
5.3.12
5.3.13
5.3.14
5.3.15
5.3.16
5.3.17
5.3.18
5.3.19
5.3.20
5.3.21
5.3.22
5.3.23
5.3.24
5.3.25
5.3.26
5.3.27
5.3.28
5.3.29
5.4.0
5.4.1
5.4.2
5.4.3
5.4.4
5.4.5
5.4.6
5.4.7
5.4.8
5.4.9
5.4.10
5.4.11
5.4.12
5.4.13
5.4.14
5.4.15
5.4.16
5.4.17
5.4.18
5.4.19
5.4.20
5.4.21
5.4.22
5.4.23
5.4.24
5.4.25
5.4.26
5.4.27
5.4.28
5.4.29
5.4.30
5.4.31
5.4.32
5.4.33
5.4.34
5.4.35
5.4.36
5.4.37
5.4.38
5.4.39
5.4.40
5.4.41
5.4.42
5.4.43
5.4.44
5.4.45
5.4snapshot
5.5.0
5.5.1
5.5.2
5.5.3
5.5.4
5.5.5
5.5.6
5.5.7
5.5.8
5.5.9
5.5.10
5.5.11
5.5.12
5.5.13
5.5.14
5.5.15
5.5.16
5.5.17
5.5.18
5.5.19
5.5.20
5.5.21
5.5.22
5.5.23
5.5.24
5.5.25
5.5.26
5.5.27
5.5.28
5.5.29
5.5.30
5.5.31
5.5snapshot
5.6.0
5.6.1
5.6.2
5.6.3
5.6.4
5.6.5
5.6.6
5.6.7
5.6.8
5.6.9
5.6.10
5.6.11
5.6.12
5.6.13
5.6.14
5.6.15
5.6.16
5.6.17
5.6snapshot
7.0.0
7.0.1
7.0.2
7.0.0RC1
7.0.0RC2
7.0.0RC3
7.0.0RC4
7.0.0RC5
7.0.0RC6
7.0.0RC7
7.0.0RC8
7.0snapshot
master

$ phpenv install -l
usage: phpenv install [--ini|-i <environment>] VERSION
      phpenv install [--ini|-i <environment>] /path/to/definition

Available versions:
5.2.17
5.3.2
5.3.3
5.3.6
5.3.8
5.3.9
5.3.10
5.3.11
5.3.12
5.3.13
5.3.14
5.3.15
5.3.16
5.3.17
5.3.18
5.3.19
5.3.20
5.3.21
5.3.22
5.3.23
5.3.24
5.3.25
5.3.26
5.3.27
5.3.28
5.3.29
5.4.0
5.4.1
5.4.2
5.4.3
5.4.4
5.4.5
5.4.6
5.4.7
5.4.8
5.4.9
5.4.10
5.4.11
5.4.12
5.4.13
5.4.14
5.4.15
5.4.16
5.4.17
5.4.18
5.4.19
5.4.20
5.4.21
5.4.22
5.4.23
5.4.24
5.4.25
5.4.26
5.4.27
5.4.28
5.4.29
5.4.30
5.4.31
5.4.32
5.4.33
5.4.34
5.4.35
5.4.36
5.4.37
5.4.38
5.4.39
5.4.40
5.4.41
5.4.42
5.4.43
5.4.44
5.4.45
5.4snapshot
5.5.0
5.5.1
5.5.2
5.5.3
5.5.4
5.5.5
5.5.6
5.5.7
5.5.8
5.5.9
5.5.10
5.5.11
5.5.12
5.5.13
5.5.14
5.5.15
5.5.16
5.5.17
5.5.18
5.5.19
5.5.20
5.5.21
5.5.22
5.5.23
5.5.24
5.5.25
5.5.26
5.5.27
5.5.28
5.5.29
5.5.30
5.5.31
5.5snapshot
5.6.0
5.6.1
5.6.2
5.6.3
5.6.4
5.6.5
5.6.6
5.6.7
5.6.8
5.6.9
5.6.10
5.6.11
5.6.12
5.6.13
5.6.14
5.6.15
5.6.16
5.6.17
5.6snapshot
7.0.0
7.0.1
7.0.2
7.0.0RC1
7.0.0RC2
7.0.0RC3
7.0.0RC4
7.0.0RC5
7.0.0RC6
7.0.0RC7
7.0.0RC8
7.0snapshot
master


configure: error: xml2-config not found. / PHP 7.0.2 インストール 1回目失敗

 閲覧数:180 投稿日:2016-01-16 更新日:2016-01-16 

1回目 失敗


$ phpenv install 7.0.2
[Info]: Loaded extension plugin
[Info]: Loaded apc Plugin.
[Info]: Loaded composer Plugin.
[Info]: Loaded github Plugin.
[Info]: Loaded uprofiler Plugin.
[Info]: Loaded xdebug Plugin.
[Info]: Loaded xhprof Plugin.
[Info]: php.ini-production gets used as php.ini
[Info]: Building 7.0.2 into /home/★★/.phpenv/versions/7.0.2
[Downloading]: https://secure.php.net/distributions/php-7.0.2.tar.bz2
[Preparing]: /tmp/php-build/source/7.0.2

-----------------
|  BUILD ERROR  |
-----------------

Here are the last 10 lines from the log:

-----------------------------------------
configure: WARNING: unrecognized options: --with-mysql
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
configure: error: xml2-config not found. Please check your libxml2 installation.
-----------------------------------------

The full Log is available at '/tmp/php-build.7.0.2.20160116180227.log'.
[Warn]: Aborting build.


「libxml2-dev」パッケージをインストール
$ yum install libxml2-devel
Loaded plugins: fastestmirror, security
You need to be root to perform this command.


$ sudo -s
[sudo] password for ★★: 

# yum install libxml2-devel
Loaded plugins: fastestmirror, security
Determining fastest mirrors
epel/metalink                                                                                         | 6.2 kB     00:00    
* base: ftp.iij.ad.jp
* epel: ftp.iij.ad.jp
* extras: ftp.iij.ad.jp
* rpmforge: mirror.fairway.ne.jp
* updates: ftp.iij.ad.jp
10gen                                                                                                 |  951 B     00:00    
base                                                                                                  | 3.7 kB     00:00    
epel                                                                                                  | 4.3 kB     00:00    
epel/primary_db                                                                                       | 5.7 MB     00:00    
extras                                                                                                | 3.4 kB     00:00    
extras/primary_db                                                                                     |  34 kB     00:00    
graphviz-stable                                                                                       |  951 B     00:00    
rpmforge                                                                                              | 1.9 kB     00:00    
updates                                                                                               | 3.4 kB     00:00    
updates/primary_db                                                                                    | 3.3 MB     00:00    
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package libxml2-devel.x86_64 0:2.7.6-20.el6_7.1 will be installed
--> Processing Dependency: libxml2 = 2.7.6-20.el6_7.1 for package: libxml2-devel-2.7.6-20.el6_7.1.x86_64
--> Running transaction check
---> Package libxml2.x86_64 0:2.7.6-14.el6 will be updated
--> Processing Dependency: libxml2 = 2.7.6-14.el6 for package: libxml2-python-2.7.6-14.el6.x86_64
---> Package libxml2.x86_64 0:2.7.6-20.el6_7.1 will be an update
--> Running transaction check
---> Package libxml2-python.x86_64 0:2.7.6-14.el6 will be updated
---> Package libxml2-python.x86_64 0:2.7.6-20.el6_7.1 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================
Package                         Arch                    Version                              Repository                Size
=============================================================================================================================
Installing:
libxml2-devel                   x86_64                  2.7.6-20.el6_7.1                     updates                  1.1 M
Updating for dependencies:
libxml2                         x86_64                  2.7.6-20.el6_7.1                     updates                  803 k
libxml2-python                  x86_64                  2.7.6-20.el6_7.1                     updates                  323 k

Transaction Summary
=============================================================================================================================
Install       1 Package(s)
Upgrade       2 Package(s)

Total download size: 2.2 M
Is this ok [y/N]:

Is this ok [y/N]:y
Downloading Packages:
(1/3): libxml2-2.7.6-20.el6_7.1.x86_64.rpm                                                            | 803 kB     00:00    
(2/3): libxml2-devel-2.7.6-20.el6_7.1.x86_64.rpm                                                      | 1.1 MB     00:00    
(3/3): libxml2-python-2.7.6-20.el6_7.1.x86_64.rpm                                                     | 323 kB     00:00    
-----------------------------------------------------------------------------------------------------------------------------
Total                                                                                        9.0 MB/s | 2.2 MB     00:00    
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
 Updating   : libxml2-2.7.6-20.el6_7.1.x86_64                                                                           1/5
 Installing : libxml2-devel-2.7.6-20.el6_7.1.x86_64                                                                     2/5
 Updating   : libxml2-python-2.7.6-20.el6_7.1.x86_64                                                                    3/5
 Cleanup    : libxml2-python-2.7.6-14.el6.x86_64                                                                        4/5
 Cleanup    : libxml2-2.7.6-14.el6.x86_64                                                                               5/5
 Verifying  : libxml2-2.7.6-20.el6_7.1.x86_64                                                                           1/5
 Verifying  : libxml2-devel-2.7.6-20.el6_7.1.x86_64                                                                     2/5
 Verifying  : libxml2-python-2.7.6-20.el6_7.1.x86_64                                                                    3/5
 Verifying  : libxml2-2.7.6-14.el6.x86_64                                                                               4/5
 Verifying  : libxml2-python-2.7.6-14.el6.x86_64                                                                        5/5

Installed:
 libxml2-devel.x86_64 0:2.7.6-20.el6_7.1                                                                                    

Dependency Updated:
 libxml2.x86_64 0:2.7.6-20.el6_7.1                         libxml2-python.x86_64 0:2.7.6-20.el6_7.1                        

Complete!


configure: error: Please reinstall the libcurl distribution / PHP 7.0.2 インストール 2回目失敗

 閲覧数:232 投稿日:2016-01-16 更新日:2016-01-16 
# exit
exit

$ phpenv install 7.0.2
[Info]: Loaded extension plugin
[Info]: Loaded apc Plugin.
[Info]: Loaded composer Plugin.
[Info]: Loaded github Plugin.
[Info]: Loaded uprofiler Plugin.
[Info]: Loaded xdebug Plugin.
[Info]: Loaded xhprof Plugin.
[Info]: php.ini-production gets used as php.ini
[Info]: Building 7.0.2 into /home/★★/.phpenv/versions/7.0.2
[Skipping]: Already downloaded and extracted https://secure.php.net/distributions/php-7.0.2.tar.bz2
[Preparing]: /tmp/php-build/source/7.0.2

-----------------
|  BUILD ERROR  |
-----------------

Here are the last 10 lines from the log:

-----------------------------------------
configure: WARNING: unrecognized options: --with-mysql
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
configure: error: Please reinstall the libcurl distribution -
   easy.h should be in <curl-dir>/include/curl/
-----------------------------------------

The full Log is available at '/tmp/php-build.7.0.2.20160116181356.log'.
[Warn]: Aborting build.


curlのヘッダーがない
・curl-develインストール
# yum install curl-devel
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: ftp.iij.ad.jp
* epel: ftp.iij.ad.jp
* extras: ftp.iij.ad.jp
* rpmforge: mirror.fairway.ne.jp
* updates: ftp.iij.ad.jp
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package libcurl-devel.x86_64 0:7.19.7-46.el6 will be installed
--> Processing Dependency: libcurl = 7.19.7-46.el6 for package: libcurl-devel-7.19.7-46.el6.x86_64
--> Processing Dependency: libidn-devel for package: libcurl-devel-7.19.7-46.el6.x86_64
--> Running transaction check
---> Package libcurl.x86_64 0:7.19.7-37.el6_4 will be updated
--> Processing Dependency: libcurl = 7.19.7-37.el6_4 for package: curl-7.19.7-37.el6_4.x86_64
---> Package libcurl.x86_64 0:7.19.7-46.el6 will be an update
---> Package libidn-devel.x86_64 0:1.18-2.el6 will be installed
--> Running transaction check
---> Package curl.x86_64 0:7.19.7-37.el6_4 will be updated
---> Package curl.x86_64 0:7.19.7-46.el6 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================
Package                          Arch                      Version                            Repository               Size
=============================================================================================================================
Installing:
libcurl-devel                    x86_64                    7.19.7-46.el6                      base                    246 k
Installing for dependencies:
libidn-devel                     x86_64                    1.18-2.el6                         base                    137 k
Updating for dependencies:
curl                             x86_64                    7.19.7-46.el6                      base                    196 k
libcurl                          x86_64                    7.19.7-46.el6                      base                    168 k

Transaction Summary
=============================================================================================================================
Install       2 Package(s)
Upgrade       2 Package(s)

Total download size: 747 k
Is this ok [y/N]:

Is this ok [y/N]: y
Downloading Packages:
(1/4): curl-7.19.7-46.el6.x86_64.rpm                                                                  | 196 kB     00:00    
(2/4): libcurl-7.19.7-46.el6.x86_64.rpm                                                               | 168 kB     00:00    
(3/4): libcurl-devel-7.19.7-46.el6.x86_64.rpm                                                         | 246 kB     00:00    
(4/4): libidn-devel-1.18-2.el6.x86_64.rpm                                                             | 137 kB     00:00    
-----------------------------------------------------------------------------------------------------------------------------
Total                                                                                        8.5 MB/s | 747 kB     00:00    
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
 Updating   : libcurl-7.19.7-46.el6.x86_64                                                                              1/6
 Installing : libidn-devel-1.18-2.el6.x86_64                                                                            2/6
 Installing : libcurl-devel-7.19.7-46.el6.x86_64                                                                        3/6
 Updating   : curl-7.19.7-46.el6.x86_64                                                                                 4/6
 Cleanup    : curl-7.19.7-37.el6_4.x86_64                                                                               5/6
 Cleanup    : libcurl-7.19.7-37.el6_4.x86_64                                                                            6/6
 Verifying  : libidn-devel-1.18-2.el6.x86_64                                                                            1/6
 Verifying  : libcurl-devel-7.19.7-46.el6.x86_64                                                                        2/6
 Verifying  : curl-7.19.7-46.el6.x86_64                                                                                 3/6
 Verifying  : libcurl-7.19.7-46.el6.x86_64                                                                              4/6
 Verifying  : curl-7.19.7-37.el6_4.x86_64                                                                               5/6
 Verifying  : libcurl-7.19.7-37.el6_4.x86_64                                                                            6/6

Installed:
 libcurl-devel.x86_64 0:7.19.7-46.el6                                                                                      

Dependency Installed:
 libidn-devel.x86_64 0:1.18-2.el6                                                                                          

Dependency Updated:
 curl.x86_64 0:7.19.7-46.el6                                 libcurl.x86_64 0:7.19.7-46.el6                                

Complete!

# exit
exit


configure: error: mcrypt.h not found. / PHP 7.0.2 インストール 3回目失敗

 閲覧数:218 投稿日:2016-01-16 更新日:2016-01-16 
$ phpenv install 7.0.2
[Info]: Loaded extension plugin
[Info]: Loaded apc Plugin.
[Info]: Loaded composer Plugin.
[Info]: Loaded github Plugin.
[Info]: Loaded uprofiler Plugin.
[Info]: Loaded xdebug Plugin.
[Info]: Loaded xhprof Plugin.
[Info]: php.ini-production gets used as php.ini
[Info]: Building 7.0.2 into /home/★★/.phpenv/versions/7.0.2
[Skipping]: Already downloaded and extracted https://secure.php.net/distributions/php-7.0.2.tar.bz2
[Preparing]: /tmp/php-build/source/7.0.2

-----------------
|  BUILD ERROR  |
-----------------

Here are the last 10 lines from the log:

-----------------------------------------
configure: WARNING: unrecognized options: --with-mysql
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
-----------------------------------------

The full Log is available at '/tmp/php-build.7.0.2.20160116182430.log'.
[Warn]: Aborting build.


mcryptのヘッダーがない
・libmcrypt-develをインストール
# yum install mcrypt libmcrypt-devel
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: ftp.iij.ad.jp
* epel: ftp.iij.ad.jp
* extras: ftp.iij.ad.jp
* rpmforge: mirror.fairway.ne.jp
* updates: ftp.iij.ad.jp
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package libmcrypt-devel.x86_64 0:2.5.8-9.el6 will be installed
---> Package mcrypt.x86_64 0:2.6.8-10.el6 will be installed
--> Processing Dependency: libmhash.so.2()(64bit) for package: mcrypt-2.6.8-10.el6.x86_64
--> Running transaction check
---> Package mhash.x86_64 0:0.9.9.9-3.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================
Package                            Arch                      Version                          Repository               Size
=============================================================================================================================
Installing:
libmcrypt-devel                    x86_64                    2.5.8-9.el6                      epel                     12 k
mcrypt                             x86_64                    2.6.8-10.el6                     epel                     83 k
Installing for dependencies:
mhash                              x86_64                    0.9.9.9-3.el6                    epel                    102 k

Transaction Summary
=============================================================================================================================
Install       3 Package(s)

Total download size: 197 k
Installed size: 448 k
Is this ok [y/N]:

Is this ok [y/N]: y
Downloading Packages:
(1/3): libmcrypt-devel-2.5.8-9.el6.x86_64.rpm                                                         |  12 kB     00:00    
(2/3): mcrypt-2.6.8-10.el6.x86_64.rpm                                                                 |  83 kB     00:00    
(3/3): mhash-0.9.9.9-3.el6.x86_64.rpm                                                                 | 102 kB     00:00    
-----------------------------------------------------------------------------------------------------------------------------
Total                                                                                        2.1 MB/s | 197 kB     00:00    
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
 Installing : mhash-0.9.9.9-3.el6.x86_64                                                                                1/3
 Installing : mcrypt-2.6.8-10.el6.x86_64                                                                                2/3
 Installing : libmcrypt-devel-2.5.8-9.el6.x86_64                                                                        3/3
 Verifying  : mcrypt-2.6.8-10.el6.x86_64                                                                                1/3
 Verifying  : mhash-0.9.9.9-3.el6.x86_64                                                                                2/3
 Verifying  : libmcrypt-devel-2.5.8-9.el6.x86_64                                                                        3/3

Installed:
 libmcrypt-devel.x86_64 0:2.5.8-9.el6                              mcrypt.x86_64 0:2.6.8-10.el6                            

Dependency Installed:
 mhash.x86_64 0:0.9.9.9-3.el6                                                                                              

Complete!

# exit
exit


configure: error: Cannot find libtidy / PHP 7.0.2 インストール 4回目失敗

 閲覧数:436 投稿日:2016-01-16 更新日:2016-01-16 
$ phpenv install 7.0.2
[Info]: Loaded extension plugin
[Info]: Loaded apc Plugin.
[Info]: Loaded composer Plugin.
[Info]: Loaded github Plugin.
[Info]: Loaded uprofiler Plugin.
[Info]: Loaded xdebug Plugin.
[Info]: Loaded xhprof Plugin.
[Info]: php.ini-production gets used as php.ini
[Info]: Building 7.0.2 into /home/★★/.phpenv/versions/7.0.2
[Skipping]: Already downloaded and extracted https://secure.php.net/distributions/php-7.0.2.tar.bz2
[Preparing]: /tmp/php-build/source/7.0.2

-----------------
|  BUILD ERROR  |
-----------------

Here are the last 10 lines from the log:

-----------------------------------------
configure: WARNING: unrecognized options: --with-mysql
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
configure: error: Cannot find libtidy
-----------------------------------------

The full Log is available at '/tmp/php-build.7.0.2.20160116183630.log'.
[Warn]: Aborting build.


libtidy-develインストール
# yum install libtidy-devel
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: ftp.iij.ad.jp
* epel: ftp.iij.ad.jp
* extras: ftp.iij.ad.jp
* rpmforge: mirror.fairway.ne.jp
* updates: ftp.iij.ad.jp
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package libtidy-devel.x86_64 0:0.99.0-19.20070615.1.el6 will be installed
--> Processing Dependency: libtidy = 0.99.0-19.20070615.1.el6 for package: libtidy-devel-0.99.0-19.20070615.1.el6.x86_64
--> Processing Dependency: libtidy-0.99.so.0()(64bit) for package: libtidy-devel-0.99.0-19.20070615.1.el6.x86_64
--> Running transaction check
---> Package libtidy.x86_64 0:0.99.0-19.20070615.1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================
Package                       Arch                   Version                                     Repository            Size
=============================================================================================================================
Installing:
libtidy-devel                 x86_64                 0.99.0-19.20070615.1.el6                    base                  97 k
Installing for dependencies:
libtidy                       x86_64                 0.99.0-19.20070615.1.el6                    base                 127 k

Transaction Summary
=============================================================================================================================
Install       2 Package(s)

Total download size: 224 k
Installed size: 1.1 M
Is this ok [y/N]:

Is this ok [y/N]: y
Downloading Packages:
(1/2): libtidy-0.99.0-19.20070615.1.el6.x86_64.rpm                                                    | 127 kB     00:00    
(2/2): libtidy-devel-0.99.0-19.20070615.1.el6.x86_64.rpm                                              |  97 kB     00:00    
-----------------------------------------------------------------------------------------------------------------------------
Total                                                                                        7.2 MB/s | 224 kB     00:00    
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
 Installing : libtidy-0.99.0-19.20070615.1.el6.x86_64                                                                   1/2
 Installing : libtidy-devel-0.99.0-19.20070615.1.el6.x86_64                                                             2/2
 Verifying  : libtidy-0.99.0-19.20070615.1.el6.x86_64                                                                   1/2
 Verifying  : libtidy-devel-0.99.0-19.20070615.1.el6.x86_64                                                             2/2

Installed:
 libtidy-devel.x86_64 0:0.99.0-19.20070615.1.el6                                                                            

Dependency Installed:
 libtidy.x86_64 0:0.99.0-19.20070615.1.el6                                                                                  

Complete!

# exit
exit


configure: error: xslt-config not found. / PHP 7.0.2 インストール 5回目失敗

 閲覧数:240 投稿日:2016-01-16 更新日:2016-01-16 
$ phpenv install 7.0.2
[Info]: Loaded extension plugin
[Info]: Loaded apc Plugin.
[Info]: Loaded composer Plugin.
[Info]: Loaded github Plugin.
[Info]: Loaded uprofiler Plugin.
[Info]: Loaded xdebug Plugin.
[Info]: Loaded xhprof Plugin.
[Info]: php.ini-production gets used as php.ini
[Info]: Building 7.0.2 into /home/★★/.phpenv/versions/7.0.2
[Skipping]: Already downloaded and extracted https://secure.php.net/distributions/php-7.0.2.tar.bz2
[Preparing]: /tmp/php-build/source/7.0.2

-----------------
|  BUILD ERROR  |
-----------------

Here are the last 10 lines from the log:

-----------------------------------------
configure: WARNING: unrecognized options: --with-mysql
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
-----------------------------------------

The full Log is available at '/tmp/php-build.7.0.2.20160116184253.log'.
[Warn]: Aborting build.


libxslt-develインストール
# yum install libxslt-devel
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: ftp.iij.ad.jp
* epel: ftp.iij.ad.jp
* extras: ftp.iij.ad.jp
* rpmforge: mirror.fairway.ne.jp
* updates: ftp.iij.ad.jp
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package libxslt-devel.x86_64 0:1.1.26-2.el6_3.1 will be installed
--> Processing Dependency: libgcrypt-devel for package: libxslt-devel-1.1.26-2.el6_3.1.x86_64
--> Running transaction check
---> Package libgcrypt-devel.x86_64 0:1.4.5-11.el6_4 will be installed
--> Processing Dependency: libgpg-error-devel for package: libgcrypt-devel-1.4.5-11.el6_4.x86_64
--> Running transaction check
---> Package libgpg-error-devel.x86_64 0:1.7-4.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================
Package                             Arch                    Version                             Repository             Size
=============================================================================================================================
Installing:
libxslt-devel                       x86_64                  1.1.26-2.el6_3.1                    base                  561 k
Installing for dependencies:
libgcrypt-devel                     x86_64                  1.4.5-11.el6_4                      base                  118 k
libgpg-error-devel                  x86_64                  1.7-4.el6                           base                   14 k

Transaction Summary
=============================================================================================================================
Install       3 Package(s)

Total download size: 693 k
Installed size: 3.2 M
Is this ok [y/N]:

Is this ok [y/N]: y
Downloading Packages:
(1/3): libgcrypt-devel-1.4.5-11.el6_4.x86_64.rpm                                                      | 118 kB     00:00    
(2/3): libgpg-error-devel-1.7-4.el6.x86_64.rpm                                                        |  14 kB     00:00    
(3/3): libxslt-devel-1.1.26-2.el6_3.1.x86_64.rpm                                                      | 561 kB     00:00    
-----------------------------------------------------------------------------------------------------------------------------
Total                                                                                        8.8 MB/s | 693 kB     00:00    
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
 Installing : libgpg-error-devel-1.7-4.el6.x86_64                                                                       1/3
 Installing : libgcrypt-devel-1.4.5-11.el6_4.x86_64                                                                     2/3
 Installing : libxslt-devel-1.1.26-2.el6_3.1.x86_64                                                                     3/3
 Verifying  : libgcrypt-devel-1.4.5-11.el6_4.x86_64                                                                     1/3
 Verifying  : libgpg-error-devel-1.7-4.el6.x86_64                                                                       2/3
 Verifying  : libxslt-devel-1.1.26-2.el6_3.1.x86_64                                                                     3/3

Installed:
 libxslt-devel.x86_64 0:1.1.26-2.el6_3.1                                                                                    

Dependency Installed:
 libgcrypt-devel.x86_64 0:1.4.5-11.el6_4                        libgpg-error-devel.x86_64 0:1.7-4.el6                      

Complete!

# exit
exit


PHP 7.0.2 インストール 6回目成功

 閲覧数:309 投稿日:2016-01-16 更新日:2016-01-16 
2016/1/16 18:47開始
・19:04終了
$ phpenv install 7.0.2
[Info]: Loaded extension plugin
[Info]: Loaded apc Plugin.
[Info]: Loaded composer Plugin.
[Info]: Loaded github Plugin.
[Info]: Loaded uprofiler Plugin.
[Info]: Loaded xdebug Plugin.
[Info]: Loaded xhprof Plugin.
[Info]: php.ini-production gets used as php.ini
[Info]: Building 7.0.2 into /home/★★/.phpenv/versions/7.0.2
[Skipping]: Already downloaded and extracted https://secure.php.net/distributions/php-7.0.2.tar.bz2
[Preparing]: /tmp/php-build/source/7.0.2
[Compiling]: /tmp/php-build/source/7.0.2
[xdebug]: Installing from source
[xdebug]: Fetching from Git Master
remote: Counting objects: 16021, done.
remote: Compressing objects: 100% (94/94), done.
remote: Total 16021 (delta 74), reused 0 (delta 0), pack-reused 15926
Receiving objects: 100% (16021/16021), 6.91 MiB | 1.81 MiB/s, done.
Resolving deltas: 100% (10178/10178), done.
[xdebug]: Compiling xdebug in /tmp/php-build/source/xdebug-master
[xdebug]: Installing xdebug configuration in /home/★★/.phpenv/versions/7.0.2/etc/conf.d/xdebug.ini
[xdebug]: Cleaning up.
[Info]: Enabling Opcache...
[Info]: Done
[Info]: The Log File is not empty, but the Build did not fail. Maybe just warnings got logged. You can review the log in /tmp/php-build.7.0.2.20160116184730.log
[Success]: Built 7.0.2 successfully.


行頭のアスタリスクは、現在の PHP のバージョンを示す
・system は、phpenv で管理されていない、このシステムのデフォルトの PHP を表す
$ phpenv versions
* system (set by /home/★★/.phpenv/version)
 7.0.2



$ php -v
PHP 5.4.32 (cli) (built: Aug 21 2014 07:33:35) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies


切り替え

 閲覧数:196 投稿日:2016-01-16 更新日:2016-01-16 
$ phpenv global 7.0.2
$ php -v
PHP 7.0.2 (cli) (built: Jan 16 2016 19:01:56) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
with Xdebug v2.4.0RC4-dev, Copyright (c) 2002-2015, by Derick Rethans

$ phpenv rehash
$ php -v
PHP 7.0.2 (cli) (built: Jan 16 2016 19:01:56) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
with Xdebug v2.4.0RC4-dev, Copyright (c) 2002-2015, by Derick Rethans

# service httpd configtest
# service httpd restart
# php -v
PHP 7.0.2 (cli) (built: Jan 16 2016 19:01:56) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
with Xdebug v2.4.0RC4-dev, Copyright (c) 2002-2015, by Derick Rethans


感想 / 疑問点 / 未確認内容

 閲覧数:214 投稿日:2016-01-16 更新日:2016-01-16 

PHP5.4.32 → PHP7.0.2


エラーなし
・バージョンアップしたらエラー発生しまくるかも、と危惧していた
・実際には、少なくとも表面上は目立った影響はなし
・PHPで構築したサイトも、普通に表示されている


ハマった点


「$ phpenv install -l」でインストール可能なPHPバージョン一覧が表示されない点が一番苦労した
・phpenvインストールすれば良いだけだが、その手順を記載していないサイトが複数あった


疑問点


rbenv
・インストールした覚えがないのにインストールされている
・phpenv インストールしたら、rbenvも自動的にインストールされる仕様なの?
$ rbenv -v
rbenv 1.0.0-14-gc388331


phpenvとrbenvを共存させるためには,rbenvのパスより後にphpenvのパスを記述しなければならない
・意味が全くわからない
・今回何も触っていない

切り替え
・Apache再起動は不要?

$ phpenv rehash
・どういう意味があるの?

libphp5.so
・コピー退避する必要がある?
※今回何もしていない
・そもそもこのファイルの役割は?


未確認内容


ディレクトリ内のローカルPHPバージョンを ☆.☆.☆ に設定して、実行してみる
$ phpenv local ☆.☆.☆
$ phpenv versions

デフォルトの PHPバージョンへ戻すには system を指定
$ phpenv global system


その他


bashコマンドプロンプト表示
・ログアウト後ログインしてみたら、bashコマンドプロンプトの左側表示が変更されていて驚く
-bash-4.1$ php -v
PHP 7.0.2 (cli) (built: Jan 16 2016 19:01:56) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
with Xdebug v2.4.0RC4-dev, Copyright (c) 2002-2015, by Derick Rethans
-bash-4.1$



PHP 5.3.3 → 5.4.32 / CentOS 6

php.ini / CentOS 6



週間人気ページランキング / 9-16 → 9-22
順位 ページタイトル抜粋 アクセス数
1 Nginx設定。エラーログレベル | Nginx(Webサーバ) 19
2 PHP実行ユーザ設定 / CentOS6 / Apache | PHP(プログラミング言語) 14
3 PHPのmb_send_mail関数でメール送信できない | メール処理システム 13
4 9回目-13.MySQL5.7.21設定 | CentOS 7 2週間無料のお試し期間 9回目(さくらVPS) 12
5 touch コマンド / viコマンド。新規ファイル作成時の違い | Linuxコマンド 8
6 ソースからビルドしたPython 2.7.3 アンインストール失敗 | Python(プログラミング言語) 7
6 FFmpeg 2.8.15 を yum インストール | ソフトウェアスイート 7
6 「設定ファイルに、暗号化 (blowfish_secret) 用の非公開パスフレーズの設定を必要とするようになりました。」対応 7
6 Python 3.5 アンインストール / yum remove | Python(プログラミング言語) 7
6 manページ日本語表示 | CentOS 7 (CentOS) 7
6 PHPファイルでchmodエラー | PHP(プログラミング言語) 7
7 ABRT により 問題が検出されました | CentOS 7 (CentOS) 6
7 Python 3.6 インストール / make altinstall | Python(プログラミング言語) 6
7 さくらVPS0 6
8 Reached target Shutdown メッセージが表示されたあと、シャットダウンまたは再起動プロセスがハングアップする | CentOS 7 (CentOS) 5
9 PHP Version 7.1.2 php-mecabエクステンション対応 / PHP 7.0.14 からのアップグレード  | MeCab(形態素解析) 4
9 echo と cat の違い 4
9 phpMyAdmin 4.4.3(phpMyAdmin) カテゴリー 4
9 tar: これは tar アーカイブではないようです 4
9 MySQL 5.5 から 5.6 へのアップグレード | MySQL(データベース) 4
2021/9/23 1:01 更新