Last active
February 14, 2025 11:19
-
-
Save Izumi-kun/62e66569e02b6b806c1b8ba6d5445b8d to your computer and use it in GitHub Desktop.
PHP 8.4 on Ubuntu 16.04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:16.04 | |
RUN apt update \ | |
&& apt upgrade -y \ | |
&& apt install -y \ | |
sudo \ | |
wget \ | |
build-essential \ | |
software-properties-common \ | |
autoconf \ | |
bison \ | |
pkg-config \ | |
libtool \ | |
libtool-bin \ | |
libzip-dev \ | |
libpng-dev \ | |
libjpeg-dev \ | |
libwebp-dev \ | |
libonig-dev \ | |
libicu-dev \ | |
libfreetype6-dev \ | |
tcl-dev | |
RUN sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test \ | |
&& sudo apt update \ | |
&& sudo apt install -y gcc-9 g++-9 \ | |
&& sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-9 | |
RUN cd ~ \ | |
&& wget https://download.gnome.org/sources/libxml2/2.9/libxml2-2.9.4.tar.xz \ | |
&& tar -xf libxml2-2.9.4.tar.xz \ | |
&& cd libxml2-2.9.4 \ | |
&& ./configure \ | |
&& make -j$(nproc) \ | |
&& sudo make install \ | |
&& rm -rf ~/libxml2-2.9.4 \ | |
&& rm ~/libxml2-2.9.4.tar.xz | |
RUN cd ~ \ | |
&& wget https://www.openssl.org/source/openssl-1.1.1g.tar.gz \ | |
&& tar -zxf openssl-1.1.1g.tar.gz \ | |
&& cd openssl-1.1.1g \ | |
&& ./config \ | |
&& make -j$(nproc) \ | |
&& sudo make install_sw \ | |
&& sudo cp -r libssl.so.1.1 /usr/lib \ | |
&& sudo cp -r libcrypto.so.1.1 /usr/lib \ | |
&& rm -rf ~/openssl-1.1.1g \ | |
&& rm ~/openssl-1.1.1g.tar.gz | |
RUN cd ~ \ | |
&& wget https://github.com/curl/curl/releases/download/curl-7_61_1/curl-7.61.1.tar.xz \ | |
&& tar -xf curl-7.61.1.tar.xz \ | |
&& cd curl-7.61.1 \ | |
&& ./configure --with-openssl \ | |
&& make -j$(nproc) \ | |
&& sudo make install \ | |
&& rm -rf ~/curl-7.61.1 \ | |
&& rm ~/curl-7.61.1.tar.xz | |
RUN cd ~ \ | |
&& wget https://github.com/madler/zlib/releases/download/v1.2.13/zlib-1.2.13.tar.xz \ | |
&& tar -xf zlib-1.2.13.tar.xz \ | |
&& cd zlib-1.2.13 \ | |
&& ./configure \ | |
&& make -j$(nproc) \ | |
&& sudo make install \ | |
&& rm -rf ~/zlib-1.2.13 \ | |
&& rm ~/zlib-1.2.13.tar.xz | |
RUN cd ~ \ | |
&& wget https://www.python.org/ftp/python/3.12.7/Python-3.12.7.tar.xz \ | |
&& tar -xf Python-3.12.7.tar.xz \ | |
&& cd Python-3.12.7 \ | |
&& ./configure \ | |
--enable-optimizations \ | |
--with-openssl=/usr/local \ | |
--with-ensurepip=no \ | |
--without-doc-strings \ | |
--without-static-libpython \ | |
--disable-test-modules \ | |
CFLAGS="-I/usr/include" \ | |
LDFLAGS="-L/usr/lib" \ | |
&& sudo make altinstall \ | |
&& rm -rf ~/Python-3.12.7 \ | |
&& rm ~/Python-3.12.7.tar.xz | |
RUN cd ~ \ | |
&& wget https://github.com/skvadrik/re2c/releases/download/4.0.1/re2c-4.0.1.tar.xz \ | |
&& tar -xf re2c-4.0.1.tar.xz \ | |
&& cd re2c-4.0.1 \ | |
&& python3.12 -m venv py312venv \ | |
&& . py312venv/bin/activate \ | |
&& ./configure \ | |
--disable-dlang \ | |
--disable-golang \ | |
--disable-haskell \ | |
--disable-java \ | |
--disable-js \ | |
--disable-ocaml \ | |
--disable-python \ | |
--disable-rust \ | |
--disable-vlang \ | |
--disable-zig \ | |
&& make -j$(nproc) \ | |
&& sudo make install \ | |
&& rm -rf ~/re2c-4.0.1 \ | |
&& rm ~/re2c-4.0.1.tar.xz | |
RUN cd ~ \ | |
&& wget https://www.sqlite.org/src/tarball/sqlite.tar.gz?r=release -O sqlite.tar.gz \ | |
&& tar -xzf sqlite.tar.gz \ | |
&& cd sqlite \ | |
&& ./configure \ | |
&& make sqlite3 -j$(nproc) \ | |
&& sudo make install \ | |
&& rm -rf ~/sqlite \ | |
&& rm ~/sqlite.tar.gz | |
RUN cd ~ \ | |
&& wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.20-stable.tar.gz \ | |
&& tar -xzf libsodium-1.0.20-stable.tar.gz \ | |
&& cd libsodium-stable \ | |
&& ./configure \ | |
&& make -j$(nproc) && make check \ | |
&& sudo make install \ | |
&& rm -rf ~/libsodium-stable \ | |
&& rm ~/libsodium-1.0.20-stable.tar.gz | |
RUN cd ~ \ | |
&& wget https://www.php.net/distributions/php-8.4.2.tar.gz \ | |
&& tar -xzf php-8.4.2.tar.gz \ | |
&& sudo mkdir -p /opt/php/php84 \ | |
&& cd php-8.4.2 \ | |
&& ./buildconf --force \ | |
&& ./configure \ | |
--enable-bcmath \ | |
--enable-intl \ | |
--enable-mbstring=shared \ | |
--enable-gd \ | |
--enable-fpm \ | |
--enable-opcache \ | |
--enable-pcntl \ | |
--with-freetype \ | |
--with-jpeg \ | |
--with-webp \ | |
--with-pdo-mysql \ | |
--with-zip \ | |
--with-zlib \ | |
--with-curl \ | |
--with-openssl \ | |
--with-sodium \ | |
--with-fpm-user=www-data \ | |
--with-fpm-group=www-data \ | |
--prefix=/opt/php/php84 \ | |
&& make -j$(nproc) \ | |
&& sudo make install \ | |
&& sudo ln -s /opt/php/php84/bin/php /usr/local/bin/php84 \ | |
&& sudo cp php.ini-production /opt/php/php84/lib/php.ini \ | |
&& sudo cp /opt/php/php84/etc/php-fpm.conf.default /opt/php/php84/etc/php-fpm.conf \ | |
&& sudo cp /opt/php/php84/etc/php-fpm.d/www.conf.default /opt/php/php84/etc/php-fpm.d/www.conf \ | |
&& sudo cp sapi/fpm/init.d.php-fpm /etc/init.d/php84-fpm \ | |
&& sudo sed -i 's%# Provides: php-fpm%# Provides: php84-fpm%' /etc/init.d/php84-fpm \ | |
&& sudo chmod +x /etc/init.d/php84-fpm \ | |
&& rm -rf ~/php-8.4.2 \ | |
&& rm ~/php-8.4.2.tar.gz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment