0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

DockerでPHP7.1環境を用意する

Posted at

概要

PHP7.1で実行しているアプリケーション保守のため、検証環境を用意する必要があったのでメモ。

備考

dockerhubの php:7.1.33-apache を利用するのが楽なんだろうけど、、、2023年9月現在コンテナをビルドしようとすると、apt-getがコケるなど困った状況に陥った。(未解決)

そのため以下の参考記事を頼りにして、amazonlinux2 + php7.1 のコンテナを作成した。

手順

コンテナにコピーするためiniファイルを用意

[Core]
display_errors = On
error_reporting = E_ALL
error_log = /var/log/httpd/error.log
log_errors = On

[Date]
date.timezone = 'Asia/Tokyo'

[mbstring]
mbstring.language = Japanese
mbstring.internal_encoding = auto
mbstring.http_input = auto
mbstring.http_output = auto
mbsting.encoding_translation = Off
mbstring.detect_order = auto

Dockerfileを作成

FROM amazonlinux:2

COPY ./php.ini /usr/local/etc/php/

RUN yum install -y wget vi httpd libxml2-devel libxslt-devel zip unzip ncurses-compat-libs

RUN wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN rpm -ivh epel-release-latest-7.noarch.rpm
RUN yum install -y http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

RUN yum install -y --enablerepo=epel libedit
RUN yum install -y --disablerepo=amzn2-core --enablerepo=remi,remi-php71 php php-xml php-zip php-mbstring

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

RUN composer global require phpstan/phpstan
RUN composer global require phpmd/phpmd

とりあえず、これでPHP7.1を実行できる環境を用意できた。

0
0
0

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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?