PHP ENV and HTTP Extension

PHP ENV and HTTP Extension

We keep having issues with http.so and iconv.so and others. So at first, we try to fix that in this way.
The Dockerfile is as following:
#Prepre the OS
FROM centos:7
MAINTAINER Carl Luo <cluo@jobs2careers.com>

ENV DEBIAN_FRONTEND noninteractive
ENV PERL_MM_USE_DEFAULT 1
ENV AWS_PHP_CACHE_DIR /tmp/awscache

RUN yum install -y gcc make
RUN yum install -y mysql-devel
RUN yum install -y openssh-clients
RUN yum install -y unzip
RUN mkdir /install/
WORKDIR /install/

#install wget
RUN yum install -y gnutls-devel
RUN curl -O http://ftp.gnu.org/gnu/wget/wget-1.18.tar.gz
RUN tar zxvf wget-1.18.tar.gz
WORKDIR /install/wget-1.18
RUN ./configure
RUN make && make install
WORKDIR /install/

#install php5.6
RUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
RUN rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
RUN yum install -y php56w
RUN yum install -y php56w-xml
RUN yum install -y php56w-mysqlnd
RUN yum install -y php56w-devel
RUN yum --enablerepo=remi,remi-php56 install -y php-pear

RUN yum install -y php56-php-raphf

#set up php
ADD conf/php.ini /etc/php.ini
ADD conf/20-iconv.ini /etc/php.d/20-iconv.ini
RUN echo "usr/\n" | pecl install pecl_http-2.6.0

The content of 20-iconv.ini is as follow:
; Enable iconv extension module
;extension=iconv.so

In php.ini, I have some configuration as follow:
extension=iconv.so
extension=raphf.so
extension=propro.so
extension=http.so

which I do not like, because the steps in 20-iconv.ini is ugly. And also my colleague who use PHP for years told me “php56w, Presumably the 'w' stands for 'webtatic', to differentiate these packages from the official CentOS ones."

So I am trying to do php56 instead of php56w. Finally we found a better way as follow.

Here is the Dockerfile:
#Prepre the OS
FROM centos:7
MAINTAINER Carl Luo <cluo@jobs2careers.com>

ENV DEBIAN_FRONTEND noninteractive
ENV PERL_MM_USE_DEFAULT 1
ENV AWS_PHP_CACHE_DIR /tmp/awscache

RUN yum install -y gcc make wget
RUN yum install -y mysql-devel
RUN mkdir /install/
WORKDIR /install/

#install php5.6
RUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
ADD conf/remi.repo /etc/yum.repos.d/remi.repo
RUN yum install -y php
RUN yum install -y php-xml
RUN yum install -y php-mysqlnd
RUN yum install -y php-common
RUN yum install -y php-devel

RUN yum install -y php-raphf
RUN yum install -y php-pecl-http

The remi.repo file is follow, the only changes are that I enabled remi and remi-php56
# Repository: http://rpms.remirepo.net/
# Blog: http://blog.remirepo.net/
# Forum: http://forum.remirepo.net/

[remi]
name=Remi's RPM repository for Enterprise Linux 7 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/7/remi/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/7/remi/mirror
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

[remi-php55]
name=Remi's PHP 5.5 RPM repository for Enterprise Linux 7 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/7/php55/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/7/php55/mirror
# NOTICE: common dependencies are in "remi-safe"
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

[remi-php56]
name=Remi's PHP 5.6 RPM repository for Enterprise Linux 7 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/7/php56/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/7/php56/mirror
# NOTICE: common dependencies are in "remi-safe"
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

[remi-test]
name=Remi's test RPM repository for Enterprise Linux 7 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/7/test/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/7/test/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

[remi-debuginfo]
name=Remi's RPM repository for Enterprise Linux 7 - $basearch - debuginfo
baseurl=http://rpms.remirepo.net/enterprise/7/debug-remi/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

[remi-php55-debuginfo]
name=Remi's PHP 5.5 RPM repository for Enterprise Linux 7 - $basearch - debuginfo
baseurl=http://rpms.remirepo.net/enterprise/7/debug-php55/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

[remi-php56-debuginfo]
name=Remi's PHP 5.6 RPM repository for Enterprise Linux 7 - $basearch - debuginfo
baseurl=http://rpms.remirepo.net/enterprise/7/debug-php56/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

[remi-test-debuginfo]
name=Remi's test RPM repository for Enterprise Linux 7 - $basearch - debuginfo
baseurl=http://rpms.remirepo.net/enterprise/7/debug-test/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

That’s it. We do not need php.ini configuration or iconv.ini.

References:
https://www.digitalocean.com/community/questions/how-to-install-php-5-6-on-centos-7-0-x64
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值