# Build instructions for Ubuntu 18.04 (and other systems)

- Thread: https://externals.io/message/107116
- Original archive: https://news-web.php.net/php.internals/107116
- Started by Nikita Popov on 2019-09-15T18:49:21+00:00
- Messages: 8
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #107116 — Nikita Popov — 2019-09-15T18:49:21+00:00

URL: https://externals.io/message/107116#107116

Hi,

Our build instructions in
https://github.com/php/php-src#building-php-source-code are currently a bit
bare... they show the basic "./buildconf && ./configure && make" cycle, but
everyone who actually tries this will quickly find out that there is a lot
more to building PHP...

Every time I compile PHP on a new system, I have to go through a pretty
long cycle of ./configure --xxx, wait until there is an error, "sudo apt
install libxxx-dev" and so on.

It would be great if someone could write up the required "apt get" and
"./configure" line to get a "reasonably large" build of PHP on a popular
Linux distro like Ubuntu 18.04, so this can be included in the README.
Something similar for MacOS would probably also be useful, where things are
even more complicated.

Bonus points for also including how to set up MySQL and Postgres in a way
that you can run mysqli/pdo_mysql and pgsql/pdo_pgsql tests. I think I lose
a couple of hours every time I try to get this working.

Anyone interested in doing this?

Regards,
Nikita

---

## #107120 — Dik Takken — 2019-09-15T20:42:04+00:00

URL: https://externals.io/message/107116#107120 · In reply to: #107116

> 
> Anyone interested in doing this?
> 

Hi Nikita,

May I suggest to provide instructions to build using Docker? This has a
number of advantages:

* Same instructions will work on Linux, MacOS and Windows
* No need to install build dependencies on your host
* Spin up a MySQL container by running 'docker run mysql:version'

I took this route a while ago when I needed to setup a dev environment
and it works nicely. I could do a write-up of this route if desired.

Part of the instructions could be cast into a Docker image that can be
published on Github and Docker Hub. This image could even have the
command to run the tests baked into the image itself. Then, anyone can
just run

    docker run php-tests:7.4

to build the sources and run the tests. For development you can mount
your local git clone in the container.

Regards,
Dik Takken

---

## #107121 — Gabriel Caruso — 2019-09-15T20:53:09+00:00

URL: https://externals.io/message/107116#107121 · In reply to: #107120

Hello Dik



> 
> > […]
>
> Hi Nikita,
>
> May I suggest to provide instructions to build using Docker? This has a
> number of advantages:
>
> * Same instructions will work on Linux, MacOS and Windows
> * No need to install build dependencies on your host
> * Spin up a MySQL container by running 'docker run mysql:version'
>
> I took this route a while ago when I needed to setup a dev environment
> and it works nicely. I could do a write-up of this route if desired.
>
> Part of the instructions could be cast into a Docker image that can be
> published on Github and Docker Hub. This image could even have the
> command to run the tests baked into the image itself. Then, anyone can
> just run
>
>     docker run php-tests:7.4
>
> to build the sources and run the tests. For development you can mount
> your local git clone in the container.
>
> Regards,
> Dik Takken
>
> --
> 
> 


The main problem with Docker and php-src is that we need to touch the OS in
order to make sure the new features and bugfixes will be compatible.

Docker create a layer on top of that, right?

Best regards,

---

## #107122 — Stanislav Malyshev — 2019-09-15T21:12:29+00:00

URL: https://externals.io/message/107116#107122 · In reply to: #107120

Hi!

> May I suggest to provide instructions to build using Docker? This has a
> number of advantages:
> 
> * Same instructions will work on Linux, MacOS and Windows
> * No need to install build dependencies on your host
> * Spin up a MySQL container by running 'docker run mysql:version'

This is certainly a good idea to have Docker build instructions as an
option, but would not be good as the only or primary option. There are
lots of situations where installing the whole docket setup on a host is
either hard or an overkill for just building PHP. But as an option it's
good.

> I took this route a while ago when I needed to setup a dev environment
> and it works nicely. I could do a write-up of this route if desired.

I think having good docker-based build instructions would certainly be
appreciated.

> Part of the instructions could be cast into a Docker image that can be
> published on Github and Docker Hub. This image could even have the
> command to run the tests baked into the image itself. Then, anyone can
> just run
> 
>     docker run php-tests:7.4
> 
> to build the sources and run the tests. For development you can mount
> your local git clone in the container.

Sounds like a nice idea.

-- 
Stas Malyshev
smalyshev@gmail.com

---

## #107123 — Dik Takken — 2019-09-15T21:21:59+00:00

URL: https://externals.io/message/107116#107123 · In reply to: #107121

> 
> 
> The main problem with Docker and php-src is that we need to touch the OS in
> order to make sure the new features and bugfixes will be compatible.
> 
> Docker create a layer on top of that, right?
> 

Correct. Honestly I was not considering the use case of testing
interactions with OS-specific features as one might do using a CI/CD
setup. Providing instructions that will work for every supported target
environment is not an easy thing to do.

I was thinking about the use case of local development where the
developer needs to build the sources on whatever OS he / she happens to
be using. Then, Docker makes much more sense as it provides a single
consistent environment that will work the same way for anyone.

---

## #107124 — Mark Randall — 2019-09-15T21:43:12+00:00

URL: https://externals.io/message/107116#107124 · In reply to: #107121

> The main problem with Docker and php-src is that we need to touch the OS in
> order to make sure the new features and bugfixes will be compatible.

What in particular needs to be adjusted at OS level to make testing 
work? If there's a list we can probably find a way around it, at least 
when running containerised.

Are you referring to installing shared libraries on the host?

-- 
Mark Randall

---

## #107125 — Aegir Leet — 2019-09-15T22:00:23+00:00

URL: https://externals.io/message/107116#107125 · In reply to: #107116

Not super familiar with building PHP, but this should be a reasonable
starting point, tested on a fresh install of Ubuntu 18.04.3:

apt install -y autoconf gcc bison re2c libxml2-dev libssl-dev
libsqlite3-dev libcurl4-openssl-dev libpng-dev libwebp-dev libjpeg-dev
vflib3-dev libc-client-dev libkrb5-dev libonig-dev libreadline-dev
libsodium-dev libargon2-0-dev libzip-dev ./buildconf ./configure
--enable-fpm --with-openssl --with-kerberos --with-imap-ssl
--with-pcre-jit --with-zlib --enable-bcmath --with-curl --enable-exif
--enable-ftp --enable-gd --with-webp --with-jpeg --with-freetype
--with-gettext --with-imap --enable-intl --enable-mbstring --with-mysqli
--enable-pcntl --with-pdo-mysql --with-readline --enable-sockets
--with-sodium --with-password-argon2 --with-zip --enable-zts



> Hi,
>
> Our build instructions in
> https://github.com/php/php-src#building-php-source-code are currently a bit
> bare... they show the basic "./buildconf && ./configure && make" cycle, but
> everyone who actually tries this will quickly find out that there is a lot
> more to building PHP...
>
> Every time I compile PHP on a new system, I have to go through a pretty
> long cycle of ./configure --xxx, wait until there is an error, "sudo apt
> install libxxx-dev" and so on.
>
> It would be great if someone could write up the required "apt get" and
> "./configure" line to get a "reasonably large" build of PHP on a popular
> Linux distro like Ubuntu 18.04, so this can be included in the README.
> Something similar for MacOS would probably also be useful, where things are
> even more complicated.
>
> Bonus points for also including how to set up MySQL and Postgres in a way
> that you can run mysqli/pdo_mysql and pgsql/pdo_pgsql tests. I think I lose
> a couple of hours every time I try to get this working.
>
> Anyone interested in doing this?
>
> Regards,
> Nikita

---

## #107225 — bjorn.x.larsson@telia.com — 2019-09-18T23:12:11+00:00

URL: https://externals.io/message/107116#107225 · In reply to: #107116

Den 2019-09-15 kl. 20:49, skrev Nikita Popov:

> Hi,
>
> Our build instructions in
> https://github.com/php/php-src#building-php-source-code are currently a bit
> bare... they show the basic "./buildconf && ./configure && make" cycle, but
> everyone who actually tries this will quickly find out that there is a lot
> more to building PHP...
>
> Every time I compile PHP on a new system, I have to go through a pretty
> long cycle of ./configure --xxx, wait until there is an error, "sudo apt
> install libxxx-dev" and so on.
>
> It would be great if someone could write up the required "apt get" and
> "./configure" line to get a "reasonably large" build of PHP on a popular
> Linux distro like Ubuntu 18.04, so this can be included in the README.
> Something similar for MacOS would probably also be useful, where things are
> even more complicated.
>
> Bonus points for also including how to set up MySQL and Postgres in a way
> that you can run mysqli/pdo_mysql and pgsql/pdo_pgsql tests. I think I lose
> a couple of hours every time I try to get this working.
>
> Anyone interested in doing this?
>
> Regards,
> Nikita

Hi,

If it's not done already I could take a swing a bit later in early October
for a Centos 7.7 distro.

r//Björn L
