Skip to content

Commit

Permalink
Add support for PHP 8.3. (#81)
Browse files Browse the repository at this point in the history
* Add support for PHP 8.3.

* Use the LTS release of Composer.

* Update documentation.

* Set the correct name for the PHP 8.3 example Lando file.

* There is no stable PECL package of xdebug yet that is compatible with PHP 8.3.

* Test that we can install the latest version of Composer.

* Use the latest version of the Redis extension.

* Remove erroneous favicon file.

---------

Co-authored-by: Alec Reynolds <[email protected]>
  • Loading branch information
pfrenssen and reynoldsalec authored Dec 12, 2023
1 parent 6abf2ef commit 82e83e2
Show file tree
Hide file tree
Showing 30 changed files with 928 additions and 61 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build-php-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ jobs:
lando-version:
- 3-dev-slim
include:
- image: php
tag: 8.3-fpm-4
context: images/8.3-fpm
- image: php
tag: 8.3-apache-4
context: images/8.3-apache
- image: php
tag: 8.2-fpm-4
context: images/8.2-fpm
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pr-php8-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
- '8.0'
- '8.1'
- '8.2'
- '8.3'
lando-version:
- 3-dev-slim
os:
Expand Down
4 changes: 2 additions & 2 deletions builders/php.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ module.exports = {
name: 'php',
config: {
version: '7.4',
supported: ['8.2', '8.1', '8.0', '7.4', '7.3', '7.2', '7.1', '7.0', '5.6', '5.5', '5.4', '5.3'],
supported: ['8.3', '8.2', '8.1', '8.0', '7.4', '7.3', '7.2', '7.1', '7.0', '5.6', '5.5', '5.4', '5.3'],
legacy: ['7.2', '7.1', '7.0', '5.6', '5.5', '5.4', '5.3'],
gen2: ['5.5', '5.4', '5.3'],
gen3: ['7.2', '7.1', '7.0', '5.6'],
Expand All @@ -109,7 +109,7 @@ module.exports = {
],
confSrc: path.resolve(__dirname, '..', 'config'),
command: ['sh -c \'a2enmod rewrite && apache2-foreground\''],
composer_version: '2.2.18',
composer_version: '2.2.22',
phpServer: 'apache',
defaultFiles: {
_php: 'php.ini',
Expand Down
Empty file.
118 changes: 59 additions & 59 deletions docs/extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,65 +5,65 @@ description: Learn what extensions are installed in the Lando PHP plugin

# Installed Extensions

| | 5.3 | 5.4 | 5.5 | 5.6 | 7.0 | 7.1 | 7.2 | 7.3 | 7.4 | 8.0 | 8.1 | 8.2 |
| -- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| apc | X | X | | | | | | | | | | |
| apcu | | | X | X | X | X | X | X | X | | | |
| bcmath | X | X | X | X | X | X | X | X | X | X | X | X |
| bz2 | X | X | X | X | X | X | X | X | X | X | X | X |
| calendar | X | X | X | X | X | X | X | X | X | X | X | X |
| Core | X | X | X | X | X | X | X | X | X | X | X | X |
| ctype | X | X | X | X | X | X | X | X | X | X | X | X |
| curl | X | X | X | X | X | X | X | X | X | X | X | X |
| date | X | X | X | X | X | X | X | X | X | X | X | X |
| dom | X | X | X | X | X | X | X | X | X | X | X | X |
| exif | X | X | X | X | X | X | X | X | X | X | X | X |
| fileinfo | X | X | X | X | X | X | X | X | X | X | X | X |
| filter | X | X | X | X | X | X | X | X | X | X | X | X |
| ftp | X | X | X | X | X | X | X | X | X | X | X | X |
| gd | X | X | X | X | X | X | X | X | X | X | X | X |
| gettext | X | X | X | X | X | X | X | X | X | X | X | X |
| hash | X | X | X | X | X | X | X | X | X | X | X | X |
| iconv | X | X | X | X | X | X | X | X | X | X | X | X |
| imagick | X | X | X | X | X | X | X | X | X | X | X | X |
| imap | X | X | X | X | X | X | X | X | X | X | X | X |
| intl | X | X | X | X | X | X | X | X | X | X | X | X |
| json | X | X | X | X | X | X | X | X | X | X | X | X |
| ldap | X | X | X | X | X | X | X | X | X | X | X | X |
| libxml | X | X | X | X | X | X | X | X | X | X | X | X |
| mbstring | X | X | X | X | X | X | X | X | X | X | X | X |
| mcrypt | X | X | X | X | X | X | X | X | X | X | X | X |
| memcached | X | X | X | X | X | X | X | X | X | | | |
| mysqli | X | X | X | X | X | X | X | X | X | X | X | X |
| mysqlnd | X | X | X | X | X | X | X | X | X | X | X | X |
| OAuth | X | X | X | X | X | X | X | X | X | | | |
| OPcache | | | X | X | X | X | X | X | X | X | X | X |
| openssl | X | X | X | X | X | X | X | X | X | X | X | X |
| pcntl | X | X | X | X | X | X | X | X | X | X | X | X |
| pcre | X | X | X | X | X | X | X | X | X | X | X | X |
| PDO | X | X | X | X | X | X | X | X | X | X | X | X |
| pdo_mysql | X | X | X | X | X | X | X | X | X | X | X | X |
| pdo_pgsql | X | X | X | X | X | X | X | X | X | X | X | X |
| pdo_sqlite| X | X | X | X | X | X | X | X | X | X | X | X |
| Phar | X | X | X | X | X | X | X | X | X | X | X | X |
| posix | X | X | X | X | X | X | X | X | X | X | X | X |
| readline | X | X | X | X | X | X | X | X | X | X | X | X |
| redis | X | X | X | X | X | X | X | X | X | X | X | X |
| readline | X | X | X | X | X | X | X | X | X | X | X | X |
| Reflection| X | X | X | X | X | X | X | X | X | X | X | X |
| session | X | X | X | X | X | X | X | X | X | X | X | X |
| SimpleXML | X | X | X | X | X | X | X | X | X | X | X | X |
| soap | X | X | X | X | X | X | X | X | X | X | X | X |
| SPL | X | X | X | X | X | X | X | X | X | X | X | X |
| sqlite3 | X | X | X | X | X | X | X | X | X | X | X | X |
| standard | X | X | X | X | X | X | X | X | X | X | X | X |
| tokenizer | X | X | X | X | X | X | X | X | X | X | X | X |
| xdebug | | | | | | | | | | | | |
| xml | X | X | X | X | X | X | X | X | X | X | X | X |
| xmlreader | X | X | X | X | X | X | X | X | X | X | X | X |
| xmlwriter | X | X | X | X | X | X | X | X | X | X | X | X |
| zip | X | X | X | X | X | X | X | X | X | X | X | X |
| zlib | X | X | X | X | X | X | X | X | X | X | X | X |
| | 5.3 | 5.4 | 5.5 | 5.6 | 7.0 | 7.1 | 7.2 | 7.3 | 7.4 | 8.0 | 8.1 | 8.2 | 8.3 |
| -- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| apc | X | X | | | | | | | | | | | |
| apcu | | | X | X | X | X | X | X | X | | | | |
| bcmath | X | X | X | X | X | X | X | X | X | X | X | X | X |
| bz2 | X | X | X | X | X | X | X | X | X | X | X | X | X |
| calendar | X | X | X | X | X | X | X | X | X | X | X | X | X |
| Core | X | X | X | X | X | X | X | X | X | X | X | X | X |
| ctype | X | X | X | X | X | X | X | X | X | X | X | X | X |
| curl | X | X | X | X | X | X | X | X | X | X | X | X | X |
| date | X | X | X | X | X | X | X | X | X | X | X | X | X |
| dom | X | X | X | X | X | X | X | X | X | X | X | X | X |
| exif | X | X | X | X | X | X | X | X | X | X | X | X | X |
| fileinfo | X | X | X | X | X | X | X | X | X | X | X | X | X |
| filter | X | X | X | X | X | X | X | X | X | X | X | X | X |
| ftp | X | X | X | X | X | X | X | X | X | X | X | X | X |
| gd | X | X | X | X | X | X | X | X | X | X | X | X | X |
| gettext | X | X | X | X | X | X | X | X | X | X | X | X | X |
| hash | X | X | X | X | X | X | X | X | X | X | X | X | X |
| iconv | X | X | X | X | X | X | X | X | X | X | X | X | X |
| imagick | X | X | X | X | X | X | X | X | X | X | X | X | X |
| imap | X | X | X | X | X | X | X | X | X | X | X | X | X |
| intl | X | X | X | X | X | X | X | X | X | X | X | X | X |
| json | X | X | X | X | X | X | X | X | X | X | X | X | X |
| ldap | X | X | X | X | X | X | X | X | X | X | X | X | X |
| libxml | X | X | X | X | X | X | X | X | X | X | X | X | X |
| mbstring | X | X | X | X | X | X | X | X | X | X | X | X | X |
| mcrypt | X | X | X | X | X | X | X | X | X | X | X | X | X |
| memcached | X | X | X | X | X | X | X | X | X | | | | |
| mysqli | X | X | X | X | X | X | X | X | X | X | X | X | X |
| mysqlnd | X | X | X | X | X | X | X | X | X | X | X | X | X |
| OAuth | X | X | X | X | X | X | X | X | X | | | | |
| OPcache | | | X | X | X | X | X | X | X | X | X | X | X |
| openssl | X | X | X | X | X | X | X | X | X | X | X | X | X |
| pcntl | X | X | X | X | X | X | X | X | X | X | X | X | X |
| pcre | X | X | X | X | X | X | X | X | X | X | X | X | X |
| PDO | X | X | X | X | X | X | X | X | X | X | X | X | X |
| pdo_mysql | X | X | X | X | X | X | X | X | X | X | X | X | X |
| pdo_pgsql | X | X | X | X | X | X | X | X | X | X | X | X | X |
| pdo_sqlite| X | X | X | X | X | X | X | X | X | X | X | X | X |
| Phar | X | X | X | X | X | X | X | X | X | X | X | X | X |
| posix | X | X | X | X | X | X | X | X | X | X | X | X | X |
| readline | X | X | X | X | X | X | X | X | X | X | X | X | X |
| redis | X | X | X | X | X | X | X | X | X | X | X | X | X |
| readline | X | X | X | X | X | X | X | X | X | X | X | X | X |
| Reflection| X | X | X | X | X | X | X | X | X | X | X | X | X |
| session | X | X | X | X | X | X | X | X | X | X | X | X | X |
| SimpleXML | X | X | X | X | X | X | X | X | X | X | X | X | X |
| soap | X | X | X | X | X | X | X | X | X | X | X | X | X |
| SPL | X | X | X | X | X | X | X | X | X | X | X | X | X |
| sqlite3 | X | X | X | X | X | X | X | X | X | X | X | X | X |
| standard | X | X | X | X | X | X | X | X | X | X | X | X | X |
| tokenizer | X | X | X | X | X | X | X | X | X | X | X | X | X |
| xdebug | | | | | | | | | | | | | |
| xml | X | X | X | X | X | X | X | X | X | X | X | X | X |
| xmlreader | X | X | X | X | X | X | X | X | X | X | X | X | X |
| xmlwriter | X | X | X | X | X | X | X | X | X | X | X | X | X |
| zip | X | X | X | X | X | X | X | X | X | X | X | X | X |
| zlib | X | X | X | X | X | X | X | X | X | X | X | X | X |

Note that `xdebug` is off by default but you can enable it by setting your `php` services config to `xdebug: true`. Read more about this in "Configuration" above.

Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ services:
## Supported versions
* [8.3](https://hub.docker.com/r/devwithlando/php) (experimental)
* [8.2](https://hub.docker.com/r/devwithlando/php)
* [8.1](https://hub.docker.com/r/devwithlando/php)
* [8.0](https://hub.docker.com/r/devwithlando/php)
Expand Down
3 changes: 3 additions & 0 deletions examples/8.3/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
vendor
composer.json
test
58 changes: 58 additions & 0 deletions examples/8.3/.lando.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: lando-php83
events:
post-start:
- defaults: php -i | grep memory_limit | grep -e "-1"
services:
defaults:
type: php:8.3
composer_version: false
cli:
type: php:8.3
composer_version: false
via: cli
build_as_root:
- curl -sL https://deb.nodesource.com/setup_14.x | bash -
- apt-get update -y
- apt-get install -y nodejs
cliworker:
type: php:8.3
composer_version: false
via: cli
command: sleep infinity
custom:
type: php:8.3
composer_version: "2.5.6"
via: nginx
ssl: true
webroot: web
xdebug: true
config:
php: config/php.ini
overrides:
image: devwithlando/php:8.3-fpm-4
environment:
DUALBLADE: maxim
OTHER: thing
custom_nginx:
build_as_root:
- mkdir -p /app/test && touch /app/test/managed_build_step
overrides:
environment:
MORE: things
OTHER: stuff
tooling:
php:
service: defaults
node:
service: :host
options:
host:
description: The service to use
default: cli
alias:
- h

# This is important because it lets lando know to test against the plugin in this repo
# DO NOT REMOVE THIS!
plugins:
"@lando/php": ./../../
131 changes: 131 additions & 0 deletions examples/8.3/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
PHP 8.3 Example
===============

This example exists primarily to test the following documentation:

* [PHP Service](https://docs.lando.dev/config/php.html)
* [Installing Node in a PHP Service](https://docs.lando.dev/guides/installing-node-in-your-lando-php-service.html)
* [Issue #1990](https://github.com/lando/lando/issues/1990)
* [Issue #2192](https://github.com/lando/lando/issues/2192)

And probably other stuff

Start up tests
--------------

Run the following commands to get up and running with this example.

```bash
# Should start up successfully
lando poweroff
lando start
```

Verification commands
---------------------

Run the following commands to validate things are rolling as they should.

```bash
# Should use 8.3 as the default php version
lando ssh -s defaults -c "php -v" | grep "PHP 8.3"

# Should use 10.x as the default postgresql-client version
lando ssh -s defaults -c "psql -V" | grep "10."

# Should use apache 2.4 as the default webserver version
lando ssh -s defaults -c "apachectl -V" | grep "2.4."

# Should only serve over http by default
lando ssh -s defaults -c "curl https://localhost" || echo $? | grep 1

# Should serve from the app root by default
lando ssh -s defaults -c "curl http://localhost" | grep "ROOTDIR"

# Should have a 1G php mem limit on appserver
lando ssh -s defaults -c "curl http://localhost" | grep "memory_limit" | grep "1G"

# Should have COMPOSER_MEMORY_LIMIT set to -1
lando ssh -s defaults -c "env" | grep "COMPOSER_MEMORY_LIMIT=-1"

# Should install composer 2.x by default
lando ssh -s defaults -c "composer --version --no-ansi" | grep "Composer version 2."

# Should have unlimited memory for php for CLI opts
lando php -i | grep memory_limit | grep -e "-1"
lando ssh -s defaults -c "php -i" | grep "memory_limit" | grep -e "-1"

# Should not enable xdebug by default
lando ssh -s defaults -c "php -m | grep xdebug" || echo $? | grep 1

# Should have a PATH_INFO and PATH_TRANSLATED SERVER vars
lando ssh -s custom_nginx -c "curl https://localhost" | grep SERVER | grep PATH_INFO
lando ssh -s custom_nginx -c "curl https://localhost" | grep SERVER | grep PATH_TRANSLATED

# Should use specified php version if given
lando ssh -s custom -c "php -v" | grep "PHP 8.3"

# Should install composer 2.5.6 if version number is set
lando ssh -s custom -c "composer --version --no-ansi" | grep "Composer version 2.5.6"

# Should serve via nginx if specified
lando ssh -s custom_nginx -c "curl http://localhost" | grep "WEBDIR"

# Should serve via https if specified
lando ssh -s custom_nginx -c "curl https://localhost" | grep "WEBDIR"

# Should enable xdebug if specified
lando ssh -s custom -c "php -m" | grep "xdebug"

# Should not serve port 80 for cli
lando ssh -s cli -c "curl http://localhost" || echo $? | grep 1

# Should install the composer 2.x using the false flag
lando ssh -s cli -c "composer --version --no-ansi" | grep "Composer version 2."

# Should use custom php ini if specified
lando ssh -s custom -c "php -i | grep memory_limit | grep 514"
lando ssh -s custom -c "curl http://custom_nginx" | grep html_errors | grep On | grep On

# Should inherit overrides from its generator
lando ssh -s custom -c "env | grep DUALBLADE | grep maxim"
lando ssh -s custom_nginx -c "env | grep DUALBLADE | grep maxim"

# Should be able to run build steps on lando managed nginx service
# https://github.com/lando/lando/issues/1990
lando ssh -s custom_nginx -c "cat /app/test/managed_build_step"

# Should be able to override lando managed nginx service
# https://github.com/lando/lando/issues/1990
lando ssh -s custom_nginx -c "env | grep OTHER | grep stuff"
lando ssh -s custom_nginx -c "env | grep MORE | grep things"

# Should set PATH_INFO and PATH_TRANSLATED if appropriate
# https://github.com/lando/lando/issues/2192
lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_INFO | grep "/a/b.php"
lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_TRANSLATED | grep "/app/web/a/b.php"
lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep SCRIPT_NAME | grep "/path_info.php"
lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_INFO | grep "/a/b.php"
lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_TRANSLATED | grep "/app/a/b.php"
lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep SCRIPT_NAME | grep "/path_info.php"

# Should allow cli services to specify a boot up command
lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity

# Should install the latest composer 2.x by default.
lando ssh -s cliworker -c "composer --version --no-ansi" | grep "Composer version 2."

# Should have node14 installed in cli service
lando node -v | grep v14.
```

Destroy tests
-------------

Run the following commands to trash this app like nothing ever happened.

```bash
# Should be destroyed with success
lando destroy -y
lando poweroff
```
Loading

0 comments on commit 82e83e2

Please sign in to comment.