First of all …
Thank you for your interest in bringing PHP support to Windows! We very much appreciate your enthusiasm.
I will describe how PHP support works on Linux and the Mac right now. Do keep in mind that Windows is a new game, and it would not have to happen in the same way as it does in the other two OSes. (Though, obviously, similar tooling may reduce the amount of work it would take to make it happen.)
How PHP support works now on Linux and macOS
As @mauriciofauth pointed out, much of what we would call “PHP support” on Travis CI is described in https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/script/php.rb, in particular, in this code branch:
- First, run
phpenv global VERSION
- if it succeeds, use that version. This is one that is pre-installed on the build image.
- If it fails, grab a pre-compiled archive from our PHP archive on remote file storage (more on this in the next section).
~/.pearrc with reverse-engineered file content (this could be quite brittle).
phpenv global VERSION again, and
phpenv rehash to activate the new PHP run time.
Creating pre-compiled PHP archives
https://github.com/travis-ci/php-src-builder is responsible for compiling and creating new PHP archives. It sets up (if necessary) a PHP building environment, compiles PHP using php-build, and uploads the archives to the right place so that
travis-build can find it at the run time.
How should PHP support on Travis look?
This is an open question. As I said earlier, I might be less work to make it look a lot like Linux and Mac. Maybe not. My understanding of the Windows ecosystem is very limited.
Option 1: Leverage current tooling
In this case, I reckon the first thing to do would be to create a base set of PHP archives for use by Windows VMs. This would start with a
language: sh job on Windows, use
php-build to compile, archive and upload to the remote file storage. I do not know if
php-build, written in bash, is compatible with “git bash”. If it’s not, it could be some work to make it so.
This would also mean that we ensure that the Windows image has a reasonable C/C++ toolchain that we can use.
Option 2: Use Windows-native tooling
It might be more intuitive for Windows developers to use the Windows-native tools. For example, https://windows.php.net/download has many archives that might be usable. Or, alternatively, Chocolatey archive(s) might be more in tune with what we need (as suggested by @mauriciofauth).
I hope all of this makes some sense, and helps you get started.