-
-
Save agnelvishal/24f42c65af2f6cace1e9387617a0182a to your computer and use it in GitHub Desktop.
#!/bin/bash | |
sudo apt update && \ | |
sudo apt install -y libzip-dev bison autoconf build-essential pkg-config git-core \ | |
libltdl-dev libbz2-dev libxml2-dev libxslt1-dev libssl-dev libicu-dev \ | |
libpspell-dev libenchant-dev libmcrypt-dev libpng-dev libjpeg8-dev \ | |
libfreetype6-dev libmysqlclient-dev libreadline-dev libcurl4-openssl-dev | |
cd $HOME | |
wget https://github.com/php/php-src/archive/php-7.2.2.tar.gz | |
tar --extract --gzip --file php-7.2.2.tar.gz | |
cd $HOME/php-src-php-7.2.2 | |
./buildconf --force | |
CONFIGURE_STRING="--prefix=/etc/php7 --with-bz2 --with-zlib --enable-zip --disable-cgi \ | |
--enable-soap --enable-intl --with-openssl --with-readline --with-curl \ | |
--enable-ftp --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ | |
--enable-sockets --enable-pcntl --with-pspell --with-enchant --with-gettext \ | |
--with-gd --enable-exif --with-jpeg-dir --with-png-dir --with-freetype-dir --with-xsl \ | |
--enable-bcmath --enable-mbstring --enable-calendar --enable-simplexml --enable-json \ | |
--enable-hash --enable-session --enable-xml --enable-wddx --enable-opcache \ | |
--with-pcre-regex --with-config-file-path=/etc/php7/cli \ | |
--with-config-file-scan-dir=/etc/php7/etc --enable-cli --enable-maintainer-zts \ | |
--with-tsrm-pthreads --enable-debug --enable-fpm \ | |
--with-fpm-user=www-data --with-fpm-group=www-data" | |
./configure $CONFIGURE_STRING | |
make && sudo make install | |
sudo chmod o+x /etc/php7/bin/phpize | |
sudo chmod o+x /etc/php7/bin/php-config | |
git clone https://github.com/krakjoe/pthreads.git | |
cd pthreads | |
/etc/php7/bin/phpize | |
./configure \ | |
--prefix='/etc/php7' \ | |
--with-libdir='/lib/x86_64-linux-gnu' \ | |
--enable-pthreads=shared \ | |
--with-php-config='/etc/php7/bin/php-config' | |
make && sudo make install | |
cd $HOME/php-src-php-7.2.2 | |
sudo mkdir -p /etc/php7/cli/ | |
sudo cp php.ini-production /etc/php7/cli/php.ini | |
echo "extension=pthreads.so" | sudo tee -a /etc/php7/cli/php.ini | |
echo "zend_extension=opcache.so" | sudo tee -a /etc/php7/cli/php.ini | |
sudo ln -s /etc/php7/bin/php /usr/bin/php |
Does not work
Did you get error message?
I've used this building snippets for Docker image building on Ubuntu 18.04
successfully.
The Dockerfile
is as follows:
FROM ubuntu:18.04
RUN apt-get update
RUN apt-get install -y libzip-dev bison autoconf build-essential pkg-config git-core \
libltdl-dev libbz2-dev libxml2-dev libxslt1-dev libssl-dev libicu-dev \
libpspell-dev libenchant-dev libmcrypt-dev libpng-dev libjpeg8-dev \
libfreetype6-dev libmysqlclient-dev libreadline-dev libcurl4-openssl-dev \
wget \
git
WORKDIR /root
RUN wget https://github.com/php/php-src/archive/php-7.2.2.tar.gz
RUN tar --extract --gzip --file php-7.2.2.tar.gz
RUN cd $HOME/php-src-php-7.2.2 && \
./buildconf --force && \
CONFIGURE_STRING="--prefix=/etc/php7.2 --with-bz2 --with-zlib --enable-zip --disable-cgi \
--enable-soap --enable-intl --with-openssl --with-readline --with-curl \
--enable-ftp --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
--enable-sockets --enable-pcntl --with-pspell --with-enchant --with-gettext \
--with-gd --enable-exif --with-jpeg-dir --with-png-dir --with-freetype-dir --with-xsl \
--enable-bcmath --enable-mbstring --enable-calendar --enable-simplexml --enable-json \
--enable-hash --enable-session --enable-xml --enable-wddx --enable-opcache \
--with-pcre-regex --with-config-file-path=/etc/php7.2/cli \
--with-config-file-scan-dir=/etc/php7.2/etc --enable-cli --enable-maintainer-zts \
--with-tsrm-pthreads --enable-debug --enable-fpm \
--with-fpm-user=www-data --with-fpm-group=www-data" && \
./configure $CONFIGURE_STRING && \
make && make install && \
chmod o+x /etc/php7.2/bin/phpize && \
chmod o+x /etc/php7.2/bin/php-config && \
git clone https://github.com/krakjoe/pthreads.git && \
cd pthreads && \
/etc/php7.2/bin/phpize && \
./configure \
--prefix='/etc/php7.2' \
--with-libdir='/lib/x86_64-linux-gnu' \
--enable-pthreads=shared \
--with-php-config='/etc/php7.2/bin/php-config' && \
make && make install
RUN cd $HOME/php-src-php-7.2.2 && \
mkdir -p /etc/php7.2/cli/ && \
cp php.ini-production /etc/php7.2/cli/php.ini && \
echo "extension=pthreads.so" >> /etc/php7.2/cli/php.ini && \
echo "zend_extension=opcache.so" >> /etc/php7.2/cli/php.ini && \
ln -s /etc/php7.2/bin/php /usr/bin/php
You can try to build this with following command:
docker build -t ubuntu-php-pthreads .
Does not work
If having any issue about building this, please write some comments to let me know :).
ln: failed to create symbolic link '/usr/bin/php': File exists
@volandku, which one file do you use? The shell script or my Dockerfile
?
@volandku, which one file do you use? The shell script or my
Dockerfile
?
I used this script on VPS Ubuntu 16.04
Tried to compile, there was warning about old kernel (2.6.34)
But, it doesnt matter, VPS supports only Ubuntu 16.04 \ Debian 9 and on ubuntu ppa\ondrej support for 16.04 was dropped, on Debian I installed frsh php ysing sury
Sorry. I cannot help you because I use the Ubuntu 18.04 and Ubuntu 20.04 at this recent time.
And just notice that Ubuntu 16.04 has been deprecated on 2021/04/30.
Does not work