facebook twitter hatena line email

「Linux/phpインストール/php5.6」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(php5.6インストール)
(rpmを使うための証明書でエラーが出る場合)
 
(同じ利用者による、間の11版が非表示)
行1: 行1:
 
==epelリポジトリ追加==
 
==epelリポジトリ追加==
 
  rpm --import http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7
 
  rpm --import http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7
  rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
+
  rpm -Uvh https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-14.noarch.rpm
  
 
==remiリポジトリ追加==
 
==remiリポジトリ追加==
 
  rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi
 
  rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi
  sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
+
  sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
 
  sudo vi /etc/yum.repos.d/remi.repo
 
  sudo vi /etc/yum.repos.d/remi.repo
  
 
  [remi]
 
  [remi]
  name=Les RPM de remi pour Enterprise Linux 6 - $basearch
+
  name=Les RPM de remi pour Enterprise Linux 7 - $basearch
  #baseurl=http://rpms.famillecollet.com/enterprise/6/remi/$basearch/
+
  #baseurl=http://rpms.famillecollet.com/enterprise/7/remi/$basearch/
  mirrorlist=http://rpms.famillecollet.com/enterprise/6/remi/mirror
+
  mirrorlist=http://rpms.famillecollet.com/enterprise/7/remi/mirror
 
  enabled=0
 
  enabled=0
 
  gpgcheck=1
 
  gpgcheck=1
行17: 行17:
 
   
 
   
 
  [remi-php56]
 
  [remi-php56]
  name=Les RPM de remi de PHP 5.6 pour Enterprise Linux 6 - $basearch
+
  name=Les RPM de remi de PHP 5.6 pour Enterprise Linux 7 - $basearch
  #baseurl=http://rpms.famillecollet.com/enterprise/6/php56/$basearch/
+
  #baseurl=http://rpms.famillecollet.com/enterprise/7/php56/$basearch/
  mirrorlist=http://rpms.famillecollet.com/enterprise/6/php56/mirror
+
  mirrorlist=http://rpms.famillecollet.com/enterprise/7/php56/mirror
 
  # WARNING: If you enable this repository, you must also enable "remi"
 
  # WARNING: If you enable this repository, you must also enable "remi"
 
  enabled=0
 
  enabled=0
 
  gpgcheck=1
 
  gpgcheck=1
 
  gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
 
  gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
 +
 +
==rpmを使うための証明書でエラーが出る場合==
 +
エラー詳細
 +
<pre>
 +
curl: (60) Peer's Certificate issuer is not recognized.
 +
More details here: http://curl.haxx.se/docs/sslcerts.html
 +
 +
curl performs SSL certificate verification by default, using a "bundle"
 +
of Certificate Authority (CA) public keys (CA certs). If the default
 +
bundle file isn't adequate, you can specify an alternate file
 +
using the --cacert option.
 +
If this HTTPS server uses a certificate signed by a CA represented in
 +
the bundle, the certificate verification probably failed due to a
 +
problem with the certificate (it might be expired, or the name might
 +
not match the domain name in the URL).
 +
If you'd like to turn off curl's verification of the certificate, use
 +
the -k (or --insecure) option.
 +
</pre>
 +
証明書更新の対応方法
 +
$ sudo yum update ca-certificates
  
 
==remi-release-6.rpm競合解消方法==
 
==remi-release-6.rpm競合解消方法==
行32: 行52:
 
  # モジュール削除する
 
  # モジュール削除する
 
  $ sudo rpm -e remi-release-5.9-1.el5.remi.noarch
 
  $ sudo rpm -e remi-release-5.9-1.el5.remi.noarch
+
 
 
==apache,mysqlのサービス停止&アンインストール==
 
==apache,mysqlのサービス停止&アンインストール==
 
  sudo /etc/rc.d/init.d/httpd stop
 
  sudo /etc/rc.d/init.d/httpd stop
行50: 行70:
 
  sudo yum -y install php-pear
 
  sudo yum -y install php-pear
 
  sudo yum -y install php-gd.x86_64 --enablerepo=remi --enablerepo=remi-php56
 
  sudo yum -y install php-gd.x86_64 --enablerepo=remi --enablerepo=remi-php56
  sudo yum -y install --enablerepo=remi,remi-php56 php-opcache.x86_64
+
  sudo yum -y install php-opcache.x86_64 --enablerepo=remi,remi-php56  
 
  sudo yum -y install php-pecl-xhprof.x86_64 --enablerepo=remi --enablerepo=remi-php56
 
  sudo yum -y install php-pecl-xhprof.x86_64 --enablerepo=remi --enablerepo=remi-php56
 +
sudo yum -y install php-fpm.x86_64 --enablerepo=remi --enablerepo=remi-php56
 
  $ php -v
 
  $ php -v
 
  PHP 5.6.0 (cli) (built: Sep  3 2014 19:58:48)
 
  PHP 5.6.0 (cli) (built: Sep  3 2014 19:58:48)
行67: 行88:
 
  sudo yum -y install php-pear.i686
 
  sudo yum -y install php-pear.i686
 
  sudo yum -y install php-gd.i686 --enablerepo=remi --enablerepo=remi-php56
 
  sudo yum -y install php-gd.i686 --enablerepo=remi --enablerepo=remi-php56
  sudo yum -y install --enablerepo=remi,remi-php56 php-opcache.i686
+
  sudo yum -y install php-opcache.i686 --enablerepo=remi,remi-php56
 
  sudo yum -y install php-pecl-xhprof.i686 --enablerepo=remi --enablerepo=remi-php56
 
  sudo yum -y install php-pecl-xhprof.i686 --enablerepo=remi --enablerepo=remi-php56
 +
sudo yum -y install php-fpm.i686 --enablerepo=remi --enablerepo=remi-php56
 
  $ php -v
 
  $ php -v
  PHP 5.6.0 (cli) (built: Sep  3 2014 19:58:48)
+
  PHP 5.6.16 (cli) (built: Nov 26 2015 07:58:22)
 +
Copyright (c) 1997-2015 The PHP Group
 +
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
 +
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
 +
==timezoneエラー==
 +
/etc/php.ini
 +
date.timezone = Asia/Tokyo

2022年10月2日 (日) 04:21時点における最新版

epelリポジトリ追加

rpm --import http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7
rpm -Uvh https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-14.noarch.rpm

remiリポジトリ追加

rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi
sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
sudo vi /etc/yum.repos.d/remi.repo
[remi]
name=Les RPM de remi pour Enterprise Linux 7 - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/7/remi/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/7/remi/mirror
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

[remi-php56]
name=Les RPM de remi de PHP 5.6 pour Enterprise Linux 7 - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/7/php56/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/7/php56/mirror
# WARNING: If you enable this repository, you must also enable "remi"
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

rpmを使うための証明書でエラーが出る場合

エラー詳細

curl: (60) Peer's Certificate issuer is not recognized.
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.

証明書更新の対応方法

$ sudo yum update ca-certificates

remi-release-6.rpm競合解消方法

sudo rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
準備中...                ########################################### [100%]
  ファイル /etc/pki/rpm-gpg/RPM-GPG-KEY-remi (パッケージ remi-release-6.5-1.el6.remi.noarch から) は、パッケージ  remi-release-5.9-1.el5.remi.noarch からのファイルと競合しています。
  ファイル /etc/yum.repos.d/remi.repo (パッケージ remi-release-6.5-1.el6.remi.noarch から) は、パッケージ remi-release-5.9-1.el5.remi.noarch からのファイルと競合しています。
# モジュール削除する
$ sudo rpm -e remi-release-5.9-1.el5.remi.noarch

apache,mysqlのサービス停止&アンインストール

sudo /etc/rc.d/init.d/httpd stop
sudo /etc/rc.d/init.d/mysqld stop
sudo yum list installed | grep php-*
sudo yum list installed | grep mysql-*
sudo yum remove php-*
sudo yum remove mysql

php5.6インストール(64bit)

sudo yum -y install php.x86_64 --enablerepo=remi --enablerepo=remi-php56
sudo yum -y install php-mbstring.x86_64 --enablerepo=remi --enablerepo=remi-php56
sudo yum -y install php-mcrypt.x86_64 --enablerepo=remi --enablerepo=remi-php56
sudo yum -y install php-devel.x86_64 --enablerepo=remi --enablerepo=remi-php56
sudo yum -y install php-mysql.x86_64 --enablerepo=remi --enablerepo=remi-php56
sudo yum -y install php-pecl-memcached.x86_64 --enablerepo=remi --enablerepo=remi-php56
sudo yum -y install php-pear
sudo yum -y install php-gd.x86_64 --enablerepo=remi --enablerepo=remi-php56
sudo yum -y install php-opcache.x86_64 --enablerepo=remi,remi-php56 
sudo yum -y install php-pecl-xhprof.x86_64 --enablerepo=remi --enablerepo=remi-php56
sudo yum -y install php-fpm.x86_64 --enablerepo=remi --enablerepo=remi-php56
$ php -v
PHP 5.6.0 (cli) (built: Sep  3 2014 19:58:48)

うまくいかない場合は以下remiを消してみる

--enablerepo=remi

php5.6インストール(32bit)

sudo yum -y install php.i686 --enablerepo=remi --enablerepo=remi-php56
sudo yum -y install php-mbstring.i686 --enablerepo=remi --enablerepo=remi-php56
sudo yum -y install php-mcrypt.i686 --enablerepo=remi --enablerepo=remi-php56
sudo yum -y install php-devel.i686 --enablerepo=remi --enablerepo=remi-php56
sudo yum -y install php-mysql.i686 --enablerepo=remi --enablerepo=remi-php56
sudo yum -y install php-pecl-memcached.i686 --enablerepo=remi --enablerepo=remi-php56
sudo yum -y install php-pear.i686
sudo yum -y install php-gd.i686 --enablerepo=remi --enablerepo=remi-php56
sudo yum -y install php-opcache.i686 --enablerepo=remi,remi-php56
sudo yum -y install php-pecl-xhprof.i686 --enablerepo=remi --enablerepo=remi-php56
sudo yum -y install php-fpm.i686 --enablerepo=remi --enablerepo=remi-php56
$ php -v
PHP 5.6.16 (cli) (built: Nov 26 2015 07:58:22)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
   with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies

timezoneエラー

/etc/php.ini

date.timezone = Asia/Tokyo