目次
PHP 7 インストールします
PHP 5と比較して
・2倍以上の高速化
・メモリ使用量の低減
が見込めるPHP 7!
そのインストール方法のご紹介〜
※CentOS 7.1 、Apache 2.4.20にインストールしています
1、リポジトリの追加(64bit)
・EPEL
1 2 |
rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-6.noarch.rpm rpm --import http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7 |
2、依存パッケージのインストール
■yumから
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
yum -y install \ libxml2-devel \ openssl-devel \ freetype-devel \ libcurl-devel \ net-snmp-devel \ libpng-devel \ libjpeg-turbo-devel \ openldap-devel \ libmcrypt-devel \ readline-devel \ gd-devel \ bzip2-devel \ libicu-devel \ libwebp-devel \ gmp-devel \ libtidy-devel \ libxslt-devel |
1 2 3 4 |
yum --enablerepo=epel install libmcrypt-devel yum --enablerepo=epel install libtidy-devel yum install libxml2-devel |
■bison-2.7 のインストール
1 2 3 4 5 6 7 |
cd /usr/local/src/ wget http://ftp.gnu.org/gnu/bison/bison-3.0.4.tar.gz tar zxvf bison-3.0.4.tar.gz cd bison-3.0.4 ./configure make make install |
■re2c のインストール
1 2 3 4 5 6 7 |
cd /usr/local/src/ wget https://sourceforge.net/projects/re2c/files/0.16/re2c-0.16.tar.gz tar zxvf re2c-0.16.tar.gz cd re2c-0.16 ./configure make make install |
3、PHP 7 本体のインストール
1 2 3 4 |
cd /usr/local/src/ wget https://github.com/php/php-src/archive/php-7.0.6.tar.gz tar xvzf php-7.0.6.tar.gz cd php-src-php-7.0.6/ |
1 |
./buildconf --force |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
./configure \ --with-libdir=lib64 \ --with-pic \ --enable-maintainer-zts \ --with-bz2 \ --with-freetype-dir \ --with-png-dir \ --with-xpm-dir \ --enable-gd-native-ttf \ --with-gettext \ --with-gmp \ --with-iconv \ --with-jpeg-dir \ --with-curl \ --with-webp-dir \ --with-png-dir \ --with-openssl \ --with-pcre-regex \ --with-zlib \ --with-layout=GNU \ --enable-exif \ --enable-ftp \ --enable-sockets \ --with-kerberos \ --enable-shmop \ --enable-calendar \ --with-libxml-dir \ --with-mhash \ --with-ldap \ --with-readline \ --with-snmp \ --with-tidy \ --with-xsl \ --with-gnu-ld \ --enable-mysqlnd \ #mysql用 --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --with-mysql-sock=/var/lib/mysql/mysql.sock \ --enable-mbstring \ --enable-fpm \ #php-fpmを使わないのであれば不要 --with-mcrypt \ --with-gd \ --with-apxs2=/usr/local/apache2/bin/apxs #Apacheにphpを導入するときに必要 |
1 2 3 |
make make test make install |
4、php.ini の設定
1 |
vim /usr/local/etc/php.ini |
以下を追加
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
expose_php = Off date.timezone = 'Asia/Tokyo' error_log = "/var/log/php_errors.log" error_reporting = E_ALL default_charset = "UTF-8" max_execution_time = 60 mbstring.language = Japanese mbstring.internal_encoding = UTF-8 mbstring.encoding_translation = Off mbstring.http_input = pass mbstring.http_output = pass mbstring.detect_order = auto mbstring.substitute_character = none mbstring.func_overload = 0 mbstring.strict_detection = Off |
5、httpd.confの設定
1 |
vim /etc/httpd/conf/httpd.conf |
1 |
LoadModule php7_module modules/libphp7.so |
になっていることを確認する
もし、以下がなければ追記
1 2 |
SetHandler application/x-httpd-php AddType text/html .php |
Apache の再起動
1 |
systemctl restart httpd |
1 2 3 4 5 |
php -v PHP 7.0.6 (cli) (built: May 16 2016 12:45:42) ( ZTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies |
こうなれば、OK!
最後に
今回は、従来よりも高速化が見込める
PHP 7をインストールしました。
yumから一気にとはいかないので、
結構つまづいたりしたのですが、
その点は、おさえたつもりです!
次回は、
mysql 5.7の導入方法です
The following two tabs change content below.
デミ
Z or R Twice
で検索すると…
最新記事 by デミ (全て見る)
- 【20分で完了】MacにDocker for Macのインストール - 2017/02/02
- 【2017年版】Web接客ツール9社を比較してみた - 2017/01/26
- 【昼休み中に完了!】Macで最新Ruby、Railsのインストールから画面表示まで - 2017/01/19