Linuxにphp7.0をyumでインストールするメモ

投稿者: | 2017年5月10日

1.php7のダウンロード
http://php.net/get/php-7.0.0.tar.gz/from/a/mirror

2.php7の解凍
#tar zxvf php-7.0.0.tar.gz
#cd php-7.0.0

3.依存パッケージをインストール
#yum install -y gcc gcc-c++  make zlib zlib-devel pcre pcre-devel  libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers

4.コンパイル
./configure –prefix=/alidata/server/php-7.0 \
–with-config-file-path=/alidata/server/php-7.0/etc \
–with-mysql=mysqlnd \
–with-pdo-mysql=mysqlnd \
–with-mysqli=mysqlnd \
–with-gd \
–with-iconv \
–with-zlib \
–enable-xml \
–enable-bcmath \
–enable-shmop \
–enable-sysvsem \
–enable-inline-optimization \
–enable-mbregex \
–enable-fpm \
–enable-mbstring \
–enable-ftp \
–enable-gd-native-ttf \
–with-openssl \
–enable-pcntl \
–enable-sockets \
–with-xmlrpc \
–enable-zip \
–enable-soap \
–without-pear \
–with-gettext \
–enable-session \
–with-mcrypt \
–with-curl \
–with-jpeg-dir \
–with-freetype-dir \
–with-xpm-dir=/usr \
–with-bz2

5.#make && make install

6.php.iniのコピー
#cp php.ini-production /alidata/server/php-7.0/etc/php.ini
#cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
#cp php-fpm.conf.default php-fpm.conf
#cp www.conf.default www.conf

7.ln -sの操作
#ln -s /alidata/server/php-7.0/bin/php /usr/bin/php
#ln -s /alidata/server/php-7.0/sbin/php-fpm /usr/bin/php-fpm

8.php -v