dockerの公式phpミラーphp:5.4-apache構成xdebug-gd-mysql-mysqli
Docker-php-apache-xdebug-gd-mysql-mysqli歴坑記は最後の小結部分を直接見ることができます.前は記録をしていました.
に縁を付ける
xdebugの追加
xdebugの対応するバージョン番号を探します
対応するバージョン番号を探して失敗した経験 ❌ネット上で紹介したxdebugサイトにphpinfo()の情報を貼ってみると、5.6,5.4,5.3に対して試したことがあり、サポートされていないことが分かった. ❌ ✅最終的にはhttps://github.com/xdebug/xdebug/tree/xdebug_2_4次の言葉に気づく
ミラーを作成
Dockerfile
やっとミラーリングできる
mlocateとgdを初歩的に追加
バージョンおよび置換ソースの表示
コンテナのdebianバージョンを表示するのはjessieです
代替ソースがアリの
Dockerfileの試行に失敗しました:
これはスキップして見ないで、記録を作ることができます...
エラーが返されました:
またエラーが発生しました
ミラーの成功
Dockerfile
やっと成功した
うんてん
一時的な方法でxdebugの場所を探します
場所を見つける
コンテナ外へコピー
変更
平日運転
各フォルダのマッピングを追加できます
mysqliの追加
Dockerfile
ミラーを作成
gdピット
ネット上のgd例を実行してエラーを報告します:
検出
Gdを追加すると、Dockerfileの内容の一部が変更されます.
まとめ
xdebugミラーを追加したDockerfile
gdのミラーを付けたDockerfile
mysql、mysqliのミラーを付けたDockerfile
実行時:
に縁を付ける
PHP & MySQL , 、 、 , mysql_connect 5.5 , php:5.4-apache
xdebugの追加
xdebugの対応するバージョン番号を探します
対応するバージョン番号を探して失敗した経験
pecl search xdebug
# pecl search xdebug
Package Stable/(Latest) Local
xdebug 2.9.4 (stable) Provides functions for function traces and profiling
試行2.9.4結果:pecl/xdebug requires PHP (version >= 7.1.0), installed version is 5.4.45
Restrict Xdebug 2.4 to PHP >= 5.4 and PHP < 7.1
ミラーを作成
Dockerfile
FROM php:5.4-apache
COPY Dockerfile /
RUN pecl channel-update pecl.php.net && \
pecl install xdebug-2.4.1 && \
docker-php-ext-enable xdebug && \
mv /Dockerfile /Dockerfile.php-5.4-apache-xdebug
# mkdir Dockerfile.php-5.4-apache-xdebug && cd Dockerfile.php-5.4-apache-xdebug
# docker build -t php-5.4-apache-xdebug .
やっとミラーリングできる
mlocateとgdを初歩的に追加
バージョンおよび置換ソースの表示
コンテナのdebianバージョンを表示するのはjessieです
# cat /etc/apt/sources.list
deb http://httpredir.debian.org/debian jessie main
deb http://httpredir.debian.org/debian jessie-updates main
deb http://security.debian.org jessie/updates main
代替ソースがアリの
mv /etc/apt/sources.list /etc/apt/sources.list.bak
echo "deb http://mirrors.aliyun.com/debian jessie main contrib non-free" >> /etc/apt/sources.list &&\
echo "deb-src http://mirrors.aliyun.com/debian jessie main contrib non-free" >> /etc/apt/sources.list &&\
echo "deb http://mirrors.aliyun.com/debian jessie-updates main contrib non-free" >> /etc/apt/sources.list &&\
echo "deb-src http://mirrors.aliyun.com/debian jessie-updates main contrib non-free" >> /etc/apt/sources.list &&\
echo "deb http://mirrors.aliyun.com/debian-security jessie/updates main contrib non-free" >> /etc/apt/sources.list &&\
echo "deb-src http://mirrors.aliyun.com/debian-security jessie/updates main contrib non-free" >> /etc/apt/sources.list &&\
Dockerfileの試行に失敗しました:
これはスキップして見ないで、記録を作ることができます...
FROM php-5.4-apache-xdebug
COPY Dockerfile /
RUN mv /Dockerfile /Dockerfile.php-5.4-apache-xdebug-mlocate-gd && \
mv /etc/apt/sources.list /etc/apt/sources.list.bak && \
echo "deb http://mirrors.aliyun.com/debian jessie main contrib non-free" >> /etc/apt/sources.list &&\
echo "deb-src http://mirrors.aliyun.com/debian jessie main contrib non-free" >> /etc/apt/sources.list &&\
echo "deb http://mirrors.aliyun.com/debian jessie-updates main contrib non-free" >> /etc/apt/sources.list &&\
echo "deb-src http://mirrors.aliyun.com/debian jessie-updates main contrib non-free" >> /etc/apt/sources.list &&\
echo "deb http://mirrors.aliyun.com/debian-security jessie/updates main contrib non-free" >> /etc/apt/sources.list &&\
echo "deb-src http://mirrors.aliyun.com/debian-security jessie/updates main contrib non-free" >> /etc/apt/sources.list &&\
apt-get update && apt-get install -y mlocate \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev && \
docker-php-ext-configure gd --with-freetype --with-jpeg && \
docker-php-ext-install -j$(nproc) gd
# mkdir Dockerfile.php-5.4-apache-xdebug-mlocate-gd && cd Dockerfile.php-5.4-apache-xdebug-mlocate-gd
# docker build -t php-5.4-apache-xdebug-mlocate-gd .
エラーが返されました:
W: There is no public key available for the following key IDs:
AA8E81B4331F7F50
:
apt-get install debian-keyring debian-archive-keyring
apt-key update
https://www.cnblogs.com/lege/p/4508736.html
またエラーが発生しました
configure: WARNING: unrecognized options: --with-freetype, --with-jpeg
error: /usr/src/php/ext/-j6 does not exist
usage: /usr/local/bin/docker-php-ext-install ext-name [ext-name ...]
ie: /usr/local/bin/docker-php-ext-install gd mysqli
/usr/local/bin/docker-php-ext-install pdo pdo_mysql
-j$(nproc)
を除去し、ミラーの成功
Dockerfile
FROM php-5.4-apache-xdebug
COPY Dockerfile /
RUN mv /Dockerfile /Dockerfile.php-5.4-apache-xdebug-mlocate-gd && \
mv /etc/apt/sources.list /etc/apt/sources.list.bak && \
echo "deb http://mirrors.aliyun.com/debian jessie main contrib non-free" >> /etc/apt/sources.list &&\
echo "deb-src http://mirrors.aliyun.com/debian jessie main contrib non-free" >> /etc/apt/sources.list &&\
echo "deb http://mirrors.aliyun.com/debian jessie-updates main contrib non-free" >> /etc/apt/sources.list &&\
echo "deb-src http://mirrors.aliyun.com/debian jessie-updates main contrib non-free" >> /etc/apt/sources.list &&\
echo "deb http://mirrors.aliyun.com/debian-security jessie/updates main contrib non-free" >> /etc/apt/sources.list &&\
echo "deb-src http://mirrors.aliyun.com/debian-security jessie/updates main contrib non-free" >> /etc/apt/sources.list &&\
apt-get update && \
apt-get install -y --assume-yes debian-keyring debian-archive-keyring apt-utils && apt-key update
RUN apt-get install -y mlocate \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev && \
docker-php-ext-configure gd --with-freetype --with-jpeg && \
docker-php-ext-install gd
# mkdir Dockerfile.php-5.4-apache-xdebug-mlocate-gd && cd Dockerfile.php-5.4-apache-xdebug-mlocate-gd
# docker build -t php-5.4-apache-xdebug-mlocate-gd .
やっと成功した
うんてん
docker run -d \
-p 80:80 \
--name virhuiai-php-7302195625-ch1tmp \
--net=virhuiai_nw \
-v /Users/jjkkll/Documents/2020-book-read/7302195625/9780470192429_All_Code/ch_01/public_files/:/var/www/html/ \
-v /Users/jjkkll/Documents/2020-book-read/7302195625/9780470192429_All_Code/ch_01/lib/:/var/www/lib \
-v /Users/jjkkll/Documents/2020-book-read/7302195625/9780470192429_All_Code/ch_01/templates/:/var/www/templates \
-v /Users/jjkkll/Documents/2020-book-read/7302195625/docker/docker-php-ext-xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
php-5.4-apache-xdebug-mlocate-gd
docker cp virhuiai-php-7302195625-ch1tmp:/etc/apache2/apache2.conf /Volumes/TmpDownload/
一時的な方法でxdebugの場所を探します
docker run -d \
-p 80:80 \
--rm \
--name virhuiai-php-7302195625-ch01 \
--net=virhuiai_nw \
php-5.4-apache-xdebug-mlocate-gd
# locate xdebug
locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory
# updatedb
# # locate xdebug
/Dockerfile.php-5.4-apache-xdebug
/Dockerfile.php-5.4-apache-xdebug-mlocate-gd
/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
/usr/local/lib/php/.registry/.channel.pecl.php.net/xdebug.reg
/usr/local/lib/php/doc/xdebug
/usr/local/lib/php/doc/xdebug/CREDITS
/usr/local/lib/php/doc/xdebug/LICENSE
/usr/local/lib/php/doc/xdebug/README.rst
/usr/local/lib/php/doc/xdebug/contrib
/usr/local/lib/php/doc/xdebug/contrib/tracefile-analyser.php
/usr/local/lib/php/doc/xdebug/contrib/xt.vim
/usr/local/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so
場所を見つける
/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
コンテナ外へコピー
docker cp virhuiai-php-7302195625-ch01:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini /Users/jjkkll/Documents/2020-book-read/7302195625/
変更
/Users/jjkkll/Documents/2020-book-read/7302195625/docker-php-ext-xdebug-4php54apache.ini
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so
xdebug.remote_enable = On
xdebug.remote_handler = dbgp
xdebug.remote_host = host.docker.internal
xdebug.remote_port = 9001
xdebug.remote_log = /var/log/php/xdebug.log
平日運転
各フォルダのマッピングを追加できます
docker run -d \
-p 80:80 \
--rm \
--name virhuiai-php-7302195625-ch01 \
--net=virhuiai_nw \
-v /Users/jjkkll/Documents/2020-book-read/7302195625/9780470192429_All_Code/ch_01/public_files/:/var/www/html/ \
-v /Users/jjkkll/Documents/2020-book-read/7302195625/9780470192429_All_Code/ch_01/lib/:/var/www/lib \
-v /Users/jjkkll/Documents/2020-book-read/7302195625/9780470192429_All_Code/ch_01/templates/:/var/www/templates \
-v /Users/jjkkll/Documents/2020-book-read/7302195625/docker/docker-php-ext-xdebug-4php54apache.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
-v /Users/jjkkll/Documents/2020-book-read/7302195625/docker/apache2-4php54apache.conf:/etc/apache2/apache2.conf \
php-5.4-apache-xdebug-mlocate-gd
mysqliの追加
Dockerfile.php-5.4-apache-xdebug-mlocate-gd-mysqli
php-5.4-apache-xdebug-mlocate-gd-mysqli
Dockerfile
FROM php-5.4-apache-xdebug-mlocate-gd
COPY Dockerfile /
RUN mv /Dockerfile /Dockerfile.php-5.4-apache-xdebug-mlocate-gd-mysqli && \
# apt-get install php5-mysql
docker-php-ext-install mysql mysqli
# mkdir Dockerfile.php-5.4-apache-xdebug-mlocate-gd-mysqli && cd Dockerfile.php-5.4-apache-xdebug-mlocate-gd-mysqli
# docker build -t php-5.4-apache-xdebug-mlocate-gd-mysqli .
ミラーを作成
docker run -d \
-p 80:80 \
--rm \
--name virhuiai-php-7302195625-ch01 \
--net=virhuiai_nw \
-v /Users/jjkkll/Documents/2020-book-read/7302195625/9780470192429_All_Code/ch_01/public_files/:/var/www/html/ \
-v /Users/jjkkll/Documents/2020-book-read/7302195625/9780470192429_All_Code/ch_01/lib/:/var/www/lib \
-v /Users/jjkkll/Documents/2020-book-read/7302195625/9780470192429_All_Code/ch_01/templates/:/var/www/templates \
-v /Users/jjkkll/Documents/2020-book-read/7302195625/docker/docker-php-ext-xdebug-4php54apache.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
-v /Users/jjkkll/Documents/2020-book-read/7302195625/docker/apache2-4php54apache.conf:/etc/apache2/apache2.conf \
php-5.4-apache-xdebug-mlocate-gd-mysqli
gdピット
ネット上のgd例を実行してエラーを報告します:
Call to undefined function imagettftext()
gd_info()
を参照:var_dump(gd_info());
array (size=11)
'GD Version' => string 'bundled (2.1.0 compatible)' (length=26)
'FreeType Support' => boolean false
'T1Lib Support' => boolean false
'GIF Read Support' => boolean true
'GIF Create Support' => boolean true
'JPEG Support' => boolean false
'PNG Support' => boolean true
'WBMP Support' => boolean true
'XPM Support' => boolean false
'XBM Support' => boolean true
'JIS-mapped Japanese Font Support' => boolean false
検出
'FreeType Support' => boolean false
Gdを追加すると、Dockerfileの内容の一部が変更されます.
docker-php-ext-configure gd --with-freetype-dir=/usr/include/freetype2 --with-jpeg-dir=/usr/include/ --with-freetype --with-jpeg --enable-gd-native-ttf && docker-php-ext-install gd
まとめ
xdebugミラーを追加したDockerfile
FROM php:5.4-apache
COPY Dockerfile /
RUN pecl channel-update pecl.php.net && \
pecl install xdebug-2.4.1 && \
docker-php-ext-enable xdebug && \
mv /Dockerfile /Dockerfile.php-5.4-apache-xdebug
# mkdir Dockerfile.php-5.4-apache-xdebug && cd Dockerfile.php-5.4-apache-xdebug
# docker build -t php-5.4-apache-xdebug .
gdのミラーを付けたDockerfile
FROM php-5.4-apache-xdebug
COPY Dockerfile /
RUN mv /Dockerfile /Dockerfile.php-5.4-apache-xdebug-mlocate-gd && \
mv /etc/apt/sources.list /etc/apt/sources.list.bak && \
echo "deb http://mirrors.aliyun.com/debian jessie main contrib non-free" >> /etc/apt/sources.list &&\
echo "deb-src http://mirrors.aliyun.com/debian jessie main contrib non-free" >> /etc/apt/sources.list &&\
echo "deb http://mirrors.aliyun.com/debian jessie-updates main contrib non-free" >> /etc/apt/sources.list &&\
echo "deb-src http://mirrors.aliyun.com/debian jessie-updates main contrib non-free" >> /etc/apt/sources.list &&\
echo "deb http://mirrors.aliyun.com/debian-security jessie/updates main contrib non-free" >> /etc/apt/sources.list &&\
echo "deb-src http://mirrors.aliyun.com/debian-security jessie/updates main contrib non-free" >> /etc/apt/sources.list &&\
apt-get update && \
apt-get install -y --assume-yes debian-keyring debian-archive-keyring apt-utils && apt-key update
RUN apt-get install -y mlocate \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev && \
docker-php-ext-configure gd --with-freetype --with-freetype-dir=/usr/include/freetype2 --with-jpeg --with-jpeg-dir=/usr/include/ --enable-gd-native-ttf && docker-php-ext-install gd
#docker-php-ext-install -j$(nproc) gd
# mkdir Dockerfile.php-5.4-apache-xdebug-mlocate-gd && cd Dockerfile.php-5.4-apache-xdebug-mlocate-gd
# docker build -t php-5.4-apache-xdebug-mlocate-gd .
mysql、mysqliのミラーを付けたDockerfile
FROM php-5.4-apache-xdebug-mlocate-gd
COPY Dockerfile /
RUN mv /Dockerfile /Dockerfile.php-5.4-apache-xdebug-mlocate-gd-mysqli && \
# apt-get install php5-mysql
docker-php-ext-install mysql mysqli
# mkdir Dockerfile.php-5.4-apache-xdebug-mlocate-gd-mysqli && cd Dockerfile.php-5.4-apache-xdebug-mlocate-gd-mysqli
# docker build -t php-5.4-apache-xdebug-mlocate-gd-mysqli .
実行時:
docker run -d \
-p 80:80 \
--name virhuiai-php-fzyz54 \
--net=virhuiai_nw \
-v /.. ./fzyz/webapps/:/var/www/html/ \
-v /.. ./fzyz/sitedata/:/var/www/sitedata/ \
-v /.. ./fzyz/miniphp/:/var/www/miniphp/ \
-v /.. ./docker-php-ext-xdebug-4php54apache.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
-v /.. ./apache2-4php54apache.conf:/etc/apache2/apache2.conf \
php-5.4-apache-xdebug-mlocate-gd-mysqli