Tag Archives: php8

Compiling PHP 8.0 on Ubuntu 20.04 Linux

PHP 8.0 was released yesterday (https://www.php.net/releases/8.0/en.php), and as PPAs aren’t ready yet, I thought I would try to compile it myself on Linux (Ubuntu 20.04 LTS).

First I downloaded and extracted the source from here: https://www.php.net/distributions/php-8.0.0.tar.gz

First, I tried to configure:

cd php-8.0.0 && ./configure

I soon found out that I was missing a couple of libraries from my system, which would be needed to compile the standard PHP extensions. I installed these by:

sudo apt install libxml2-dev libsqlite3-dev

Then I needed to configure again:

./configure

Once that has been sucessful, you can then compile and build:

make -j 6

Note the -j command switch incicates how many concurrent tasks that make can carry out – as I have a 8 core processessor, I went for 6.

Once it has compiled sucessfully, then you can run the tests. There are more than 10,000 tests in PHP 8.0.0, so this may take some time:

make test

If you’re happy that it compiled sucessfully, then you can install it (I didn’t do this step, as I only wanted to try it):

sudo make install

To see which modules got compiled:

./sapi/cli/php -m

To see the PHPINFO output:

./sapi/cli/php -i

If the modules you need / were expecting don’t appear, then you need to add then via –with statements when you ./configure.