2017-06-27 6 views
0

Ich migriere ein extrem altes und in PHP geschriebenes Altsystem. Momentan habe ich gute Fortschritte gemacht, der Code verwendet jedoch eine Bibliothek namens PHPLot, wo sie von php-gd abhängt.Docker - Installiere PHP 5.2.17 und php-gd

Ich habe alles gemacht ... Ich habe versucht, diese Abhängigkeit für 3 Tage zu installieren. Kannst du mir helfen?

Hier ist meine Dockerfile:

FROM httpd:2.2 

MAINTAINER Marcus Campos <[email protected]> 

ENV HTTPD_CONF $HTTPD_PREFIX/conf/httpd.conf 
ENV PHP_INI /usr/local/lib/php.ini 
ENV HOME /root 

RUN usermod -u 1000 www-data && groupmod -g 1000 www-data \ 
    && sed -i 's/User daemon/User www-data/' $HTTPD_CONF \ 
    && sed -i 's/Group daemon/Group www-data/' $HTTPD_CONF 

WORKDIR $HOME 

ADD http://www.geocities.jp/aoba_suzukaze/php-5.2.17.tar.bz2 . 
ADD http://www.geocities.jp/aoba_suzukaze/libxml29_compat.patch . 

RUN echo 'ServerName localhost:80' >> $HTTPD_CONF 

RUN apt-get update && apt install -y --no-install-recommends bzip2 gcc  make libxml2-dev libmysqlclient-dev patch autoconf 

RUN ln -sf /usr/lib/x86_64-linux-gnu/libmysqlclient.so /usr/lib/libmysqlclient.so \ 
    && ln -sf /usr/lib/x86_64-linux-gnu/libmysqlclient.a /usr/lib/libmysqlclient.a 

RUN set -x \ 
    && tar -xf php-5.2.17.tar.bz2 \ 
    && cd php-5.2.17 \ 
    && patch -p0 < $HOME/libxml29_compat.patch \ 
    && ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-mysqli --with-pdo-mysql --enable-mbstring \ 
    && make -j"$(nproc)" \ 
    && make install \ 
    && cp php.ini-recommended $PHP_INI 

RUN echo '<FilesMatch \.php$>' >> $HTTPD_CONF \ 
    && echo ' SetHandler application/x-httpd-php' >> $HTTPD_CONF \ 
    && echo '</FilesMatch>' >> $HTTPD_CONF 

RUN sed -i 's/"GPCS"/"EGPCS"/' $PHP_INI 

RUN pecl install xdebug-2.2.7 \ 
    && echo 'zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so"' >> $PHP_INI \ 
    && echo 'xdebug.remote_enable=On' >> $PHP_INI \ 
    && echo 'xdebug.remote_connect_back=On' >> $PHP_INI \ 
    && echo 'xdebug.remote_autostart=On' >> $PHP_INI \ 
    && echo 'xdebug.idekey="xdebug"' >> $PHP_INI 

WORKDIR $HTTPD_PREFIX/htdocs/ 

UPDATE:

Ich war in der Lage, das Problem zu lösen. Hier ist mein Code mit der Lösung:

FROM httpd:2.2 

MAINTAINER Marcus Campos <[email protected]> 

ENV HTTPD_CONF $HTTPD_PREFIX/conf/httpd.conf 
ENV PHP_INI /usr/local/lib/php.ini 
ENV HOME /root 

RUN usermod -u 1000 www-data && groupmod -g 1000 www-data \ 
    && sed -i 's/User daemon/User www-data/' $HTTPD_CONF \ 
    && sed -i 's/Group daemon/Group www-data/' $HTTPD_CONF 

WORKDIR $HOME 

ADD http://www.geocities.jp/aoba_suzukaze/php-5.2.17.tar.bz2 . 
ADD http://www.geocities.jp/aoba_suzukaze/libxml29_compat.patch . 

RUN echo 'ServerName localhost:80' >> $HTTPD_CONF 

RUN apt-get update && apt install -y --no-install-recommends bzip2 gcc make libxml2-dev libmysqlclient-dev patch autoconf libjpeg-dev libpng12-dev 

RUN ln -sf /usr/lib/x86_64-linux-gnu/libmysqlclient.so /usr/lib/libmysqlclient.so \ 
    && ln -sf /usr/lib/x86_64-linux-gnu/libmysqlclient.a /usr/lib/libmysqlclient.a 

RUN set -x \ 
    && ln -s /usr/lib/x86_64-linux-gnu/libjpeg.a /usr/lib/libjpeg.a \ 
    && ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib/libjpeg.so \ 
    && ln -s /usr/lib/x86_64-linux-gnu/libpng.a /usr/lib/libpng.a \ 
    && ln -s /usr/lib/x86_64-linux-gnu/libpng.so /usr/lib/libpng.so \ 
    && tar -xf php-5.2.17.tar.bz2 \ 
    && cd php-5.2.17 \ 
    && patch -p0 < $HOME/libxml29_compat.patch \ 
    && ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-mysqli --with-pdo-mysql --enable-mbstring \ 
    && make -j"$(nproc)" \ 
    && make install \ 
    && cp php.ini-recommended $PHP_INI 

RUN echo '<FilesMatch \.php$>' >> $HTTPD_CONF \ 
    && echo ' SetHandler application/x-httpd-php' >> $HTTPD_CONF \ 
    && echo '</FilesMatch>' >> $HTTPD_CONF 

RUN sed -i 's/"GPCS"/"EGPCS"/' $PHP_INI 

RUN pecl install xdebug-2.2.7 \ 
    && echo 'zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so"' >> $PHP_INI \ 
    && echo 'xdebug.remote_enable=On' >> $PHP_INI \ 
    && echo 'xdebug.remote_connect_back=On' >> $PHP_INI \ 
    && echo 'xdebug.remote_autostart=On' >> $PHP_INI \ 
    && echo 'xdebug.idekey="xdebug"' >> $PHP_INI 

WORKDIR $HTTPD_PREFIX/htdocs/ 
+0

Die Bibliothek, die Sie erwähnt ist keine Erweiterung, sondern eine Bibliothek. Was hat das Obige genau damit zu tun? – Mjh

+0

Das ist wahr. Ich muss die Erweiterung gd.so installieren ... Ich recherchierte das Internet und in der Vergangenheit konnte man apt-get install php5-gd installieren, aber heute funktioniert das nicht mehr. –

+0

Darf ich vorschlagen, dass Sie [diese PPA] (https://launchpad.net/~ondrej/+archive/ubuntu/php) für Ihre Aufgabe verwenden? Ich glaube, Ihr Problem würde damit ganz leicht verschwinden. – Mjh

Antwort

0

Auf Ihrer configure Zeile:

Um GD-Unterstützung konfiguriert PHP --with-gd [= DIR] zu ermöglichen, wobei DIR die GD Basis-Installationsverzeichnis . Verwenden Sie die Konfigurationsoption --with-gd, um die empfohlene gebündelte Version der GD-Bibliothek zu verwenden. Die GD-Bibliothek benötigt libpng und libjpeg zum Kompilieren.

http://php.net/manual/en/image.installation.php

+0

Wo finde ich diese Bibliotheken? –

+0

Sie sollten einfach --with-gd in Ihrer configure-Zeile hinzufügen können. Funktioniert das nicht? Wenn nicht apt-get install gd – delboy1978uk

+0

Die bash gibt 'configure: error: libpng. (A | so) nicht gefunden.' –

Verwandte Themen