1
1

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.

CentOS7のPHPをダウングレードしたのでメモ

Last updated at Posted at 2018-05-30

 諸事情により、以下のクラウド環境におけるPHPを7.0から5.6にダウングレードした。

  • CentOS 7系
  • Apache 2.4
  • PHP 7.0.3

1. インストールされているPHPのモジュールを確認

yum list installed | grep php

こんな感じでズラーとでる。

php70-php-common.x86_64              7.0.18-1.el7.remi               @remi
php70-php-fpm.x86_64                 7.0.18-1.el7.remi               @remi
php70-php-gd.x86_64                  7.0.18-1.el7.remi               @remi
php70-php-json.x86_64                7.0.18-1.el7.remi               @remi
php70-php-mbstring.x86_64            7.0.18-1.el7.remi               @remi
php70-php-mcrypt.x86_64              7.0.18-1.el7.remi               @remi
php70-php-mysqlnd.x86_64             7.0.18-1.el7.remi               @remi
php70-php-pdo.x86_64                 7.0.18-1.el7.remi               @remi
php70-php-pecl-zip.x86_64            1.14.0-1.el7.remi               @remi
php70-php-xml.x86_64                 7.0.18-1.el7.remi               @remi
php70-runtime.x86_64                 1.0-5.el7.remi                  @remi

2. PHP7を拡張モジュール含め全てアンインストール

正規表現でやってもいいが、こんな感じでスペースで指定
-yオプションは、依存関係も含めて確認なしでremoveしてくれる。

yum -y remove php70-php-common php70-php-fpm php70-php-gd ....

3. php5.6のremiをインストール

yum install --enablerepo=remi,remi-php56 php php-devel php-mbstring php-pdo php-gd php-xml php-mcrypt

4. パスを変更する

 以下パスの更新コマンドが書いてあるので、コピペで実行する。

/opt/remi/php56/enable
export PATH=/opt/remi/php56/root/usr/bin:/opt/remi/php56/root/usr/sbin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/opt/remi/php56/root/usr/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export MANPATH=/opt/remi/php56/root/usr/share/man:${MANPATH}

5. Apache再起動

/bin/systemctl restart  httpd.service

確認して終わり

php -v
PHP 5.6.36 (cli) (built: Apr 25 2018 09:44:45)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?