Compile PHP8 on Windows WSL2 Ubuntu

To be able to test PHP 8 and get an impression of how big the changes are going to be, I wanted to run PHP8 on my local system with most of the default extensions in place.

If you want to know more about my local development setup, have a look at

Here's a short guide on how to compile PHP8 on a Windows 10 machine using Ubuntu 20.20 in WSL2:

Install Pre-Requisites

First we need to install the requirements for building PHP and some extensions:

 sudo apt-get install build-essential \
    autoconf \
    libtool \
    bison \
    re2c \
    libxml2-dev \
    libonig-dev \
    libssl-dev \
    libargon2-0-dev \
    libsodium-dev \
    libcurl4-openssl-dev \
    libreadline-dev \
    libyaml-dev \
    libxml2-dev \
    libcurl4-openssl-dev \
    libjpeg-dev \
    libpng-dev \
    libwebp-dev \
    libxpm-dev \
    libmysqlclient-dev \
    libpq-dev \
    libicu-dev \
    libfreetype6-dev \
    libldap2-dev \
    libxslt-dev \
    libssl-dev \

Link Ldap library

The configure command didn't find the ldap libraries out of the box, so I manually linked them via:

sudo ln -s /usr/lib/x86_64-linux-gnu/ /usr/lib/ && sudo ln -s /usr/lib/x86_64-linux-gnu/ /usr/lib/

Download PHP 8

Download the latest PHP 8 release from and extract it (PHP 8.0 beta1 at the time of writing).

tar -xzf php-8.0.3.tar.gz
cd php-8.0.3

Configure PHP

The following command configures the build with a few extensions useful for PHP web applications (like ldap or openssl):

./configure --prefix=/usr/local/php --enable-bcmath \
--enable-calendar --enable-opcache --enable-mbstring \
--enable-intl --enable-mysqlnd --with-mysqli --with-pgsql \
--with-ldap --with-xsl --with-readline --with-zlib \
--with-curl --with-openssl --with-password-argon2 --with-sodium \
--with-gmp --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-zip \
--enable-gd --with-jpeg --with-webp

Run make and install

Now run make and make install to install PHP:

make test
sudo make install

Have fun!
PHP 8 is now installed at: /usr/local/php/bin/