LoginSignup
0
1

More than 5 years have passed since last update.

CentOS7.2にPHP7.0.*をインストールする

Last updated at Posted at 2016-10-16

PHP5.6のインストール

Yumのアップデート

$ sudo yum -y update

基本パッケージのインストール

$ sudo yum -y install httpd httpd-devel mysql mysql-devel mysql-server mysql_secure_installation openssl-devel curl-devel git zip unzip

ImageMagic系のインストール

$ sudo yum -y install http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm ImageMagick ImageMagick-devel

rpmのインストール

$ sudo rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/7/x86_64/e/epel-release-7-8.noarch.rpm
$ sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

最新のrepoはここからインストール
http://ftp.iij.ad.jp/pub/linux/fedora/epel/7/x86_64/e/
http://rpms.famillecollet.com/enterprise/

PHP5.6.*のインストール

$ sudo yum install -y gcc bison libxml2 libxml2-devel openssl-devel libcurl-devel libjpeg-turbo-devel libpng-devel libmcrypt-devel readline-devel libtidy-devel libxslt-devel
$ sudo yum -y install --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof php-pdo

確認

$ php -v

Apacheの設定

$ sudo vi /etc/httpd/conf/httpd.conf

以下を追記

# PHP7をインストールする場合は不要
LoadModule php5_module modules/libphp5.so

<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>

PHP7.0.*をインストール手順

先程インストールしたPHP5.6を削除する

$ sudo yum remove php-*

PHP7.0.*のインストール

$ sudo yum -y install --enablerepo=remi-php70 php php-mbstring php-pear php-fpm php-mcrypt php-devel php-xml php-pdo

確認

$ php -v
0
1
1

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
0
1