@lando/php 1.9.0 → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md ADDED
@@ -0,0 +1,81 @@
1
+ # PROJECT KNOWLEDGE BASE
2
+
3
+ **Generated:** 2026-01-09
4
+ **Commit:** 355c304
5
+ **Branch:** main
6
+
7
+ ## OVERVIEW
8
+
9
+ Lando PHP plugin - provides PHP services (5.3-8.5) via nginx/apache/cli with composer, xdebug support. Part of @lando ecosystem.
10
+
11
+ ## STRUCTURE
12
+
13
+ ```
14
+ lando--php/
15
+ ├── builders/ # Service builders (php.js = main logic)
16
+ ├── config/ # PHP/nginx config templates
17
+ ├── utils/ # Helper functions
18
+ ├── examples/ # Version-specific test fixtures (php-*)
19
+ ├── test/ # Unit tests (placeholder)
20
+ ├── docs/ # Project documentation markdown files and associated Vitepress site
21
+ ├── scripts/ # Helper scripts for build/install/etc
22
+ └── images/ # Docker image definitions for various PHP versions
23
+ ```
24
+
25
+ ## WHERE TO LOOK
26
+
27
+ | Task | Location | Notes |
28
+ |------|----------|-------|
29
+ | PHP version logic | `builders/php.js` | LandoPhp class, version detection |
30
+ | Nginx wrapper | `builders/php-nginx.js` | Extends @lando/nginx |
31
+ | Composer install | `builders/php.js:getDefaultComposerVersion()` | Version auto-detection |
32
+ | Xdebug config | `builders/php.js:xdebugConfig()` | Per-version handling |
33
+ | PHP config templates | `config/*.conf.tpl` | EJS templates |
34
+ | Add CLI/build steps | `utils/add-build-step.js` | Front/back insertion |
35
+ | Install command gen | `utils/get-install-commands.js` | Package manager abstraction |
36
+
37
+ ## CODE MAP
38
+
39
+ | Symbol | Type | Location | Role |
40
+ |--------|------|----------|------|
41
+ | `LandoPhp` | class | builders/php.js:18 | Main service builder |
42
+ | `getDefaultComposerVersion` | fn | builders/php.js | Composer version detection |
43
+ | `nginxConfig` | fn | builders/php.js | Nginx service config |
44
+ | `xdebugConfig` | fn | builders/php.js | Xdebug version handling |
45
+ | `parseApache/Cli/Nginx` | fns | builders/php.js | Via-specific parsing |
46
+ | `addBuildStep` | fn | utils/add-build-step.js | Build step insertion |
47
+ | `getInstallCommands` | fn | utils/get-install-commands.js | Install command gen |
48
+ | `cloneOverrides` | fn | utils/clone-overrides.js | Deep clone sans image/build |
49
+
50
+ ## CONVENTIONS
51
+
52
+ - **ESLint**: Google style, max-len 140, JSDoc required for functions
53
+ - **Images**: `devwithlando/php:{version}-{via}` format
54
+ - **Versions**: Supported 5.3-8.5, legacy removed at 8.x
55
+ - **Via options**: apache (default), nginx, cli
56
+ - **Composer**: v1 for PHP <7.2, v2 otherwise
57
+
58
+ ## ANTI-PATTERNS
59
+
60
+ - Don't modify `index.js` - intentionally empty placeholder
61
+ - Don't add dependencies without checking @lando/nginx compatibility
62
+ - examples/* are test fixtures - structured identically per version
63
+
64
+ ## COMMANDS
65
+
66
+ ```bash
67
+ # Development
68
+ npm run lint # ESLint check
69
+ npm run test:unit # Mocha unit tests
70
+ npm run test:leia # Leia integration tests
71
+
72
+ # Coverage
73
+ nyc covers: lib/, recipes/, services/, types/
74
+ ```
75
+
76
+ ## NOTES
77
+
78
+ - `plugin.yml` has `legacy: true` for Lando v3 compatibility
79
+ - Root `.lando.yml` is for docs site (vitepress), not plugin testing
80
+ - Test file `test/auth.spec.js` is placeholder ("should have tests")
81
+ - PHP config uses EJS templates (`.conf.tpl` extension)
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  ## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }})
2
2
 
3
+ ## v1.11.0 - [February 19, 2026](https://github.com/lando/php/releases/tag/v1.11.0)
4
+
5
+ * Fixed database client auto-detection for recipe-based services [#223](https://github.com/lando/php/pull/223)
6
+
7
+ ## v1.10.0 - [February 18, 2026](https://github.com/lando/php/releases/tag/v1.10.0)
8
+
9
+ * Added database client auto-detection and version matching [#212](https://github.com/lando/php/pull/212)
10
+ * Added Docker image build status badge to README
11
+ * Added GD AVIF support verification for PHP 8.3+ [#219](https://github.com/lando/php/pull/219)
12
+ * Fixed composer install ordering to run before user build steps
13
+ * Fixed MariaDB wrapper script command names and test auto-detection [#212](https://github.com/lando/php/pull/212)
14
+ * Fixed typo in documentation
15
+ * Updated Docker image base version to Debian 13
16
+ * Updated Docker image tags from -6 to -7
17
+ * Updated Node.js 14.x to 20.x in test examples [#215](https://github.com/lando/php/pull/215)
18
+ * Updated `actions/cache` from 4 to 5
19
+ * Updated `actions/checkout` from 4 to 6
20
+
3
21
  ## v1.9.0 - [December 5, 2025](https://github.com/lando/php/releases/tag/v1.9.0)
4
22
 
5
23
  * Added support for PHP 8.5
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # PHP Lando Plugin
2
2
 
3
+ [![Build PHP Images](https://github.com/lando/php/actions/workflows/build-php-images.yml/badge.svg)](https://github.com/lando/php/actions/workflows/build-php-images.yml)
4
+
3
5
  This is the _official_ [Lando](https://lando.dev) plugin for [PHP](https://php.net). When installed it...
4
6
 
5
7
  * Allows users to run various `php` versions
@@ -16,7 +18,7 @@ Add a `php` service to your Landofile
16
18
  ```yaml
17
19
  services:
18
20
  myservice:
19
- type: php:8.1
21
+ type: php:8.5
20
22
  via: nginx
21
23
  webroot: www
22
24
  ```
@@ -43,6 +45,7 @@ We try to log all changes big and small in both [THE CHANGELOG](https://github.c
43
45
 
44
46
  * [@pirog](https://github.com/pirog)
45
47
  * [@reynoldsalec](https://github.com/reynoldsalec)
48
+ * [@aaronfeledy](https://github.com/AaronFeledy)
46
49
 
47
50
  ## Contributors
48
51
 
package/builders/php.js CHANGED
@@ -58,6 +58,34 @@ const xdebugConfig = host => ([
58
58
  `remote_host=${host}`,
59
59
  ].join(' '));
60
60
 
61
+ const detectDatabaseClient = (options, debug = () => {}) => {
62
+ if (options.db_client === false) return null;
63
+ if (options.db_client && options.db_client !== 'auto') return options.db_client;
64
+
65
+ const services = options._app?.config?.services || {};
66
+ let mysqlVersion = null;
67
+ let mariaVersion = null;
68
+
69
+ for (const service of Object.values(services)) {
70
+ const type = service?.type || '';
71
+ // Match mysql:X or recipe-mysql:X (e.g., backdrop-mysql:8.0, drupal-mysql:8.4)
72
+ const mysqlMatch = type.match(/(?:^|-)mysql:(\d+(?:\.\d+)?)/);
73
+ if (mysqlMatch && !mysqlVersion) mysqlVersion = mysqlMatch[1];
74
+ // Match mariadb:X or recipe-mariadb:X (e.g., backdrop-mariadb:10.6, drupal-mariadb:11.4)
75
+ const mariaMatch = type.match(/(?:^|-)mariadb:(\d+(?:\.\d+)?)/);
76
+ if (mariaMatch && !mariaVersion) mariaVersion = mariaMatch[1];
77
+ }
78
+
79
+ if (mariaVersion && mysqlVersion) {
80
+ debug('Both MariaDB (%s) and MySQL (%s) detected; using MariaDB. Set db_client to override.',
81
+ mariaVersion, mysqlVersion);
82
+ }
83
+
84
+ if (mariaVersion) return `mariadb:${mariaVersion}`;
85
+ if (mysqlVersion) return `mysql:${mysqlVersion}`;
86
+ return null;
87
+ };
88
+
61
89
  /**
62
90
  * Helper function to build a package string by combining package name and version
63
91
  *
@@ -163,8 +191,9 @@ module.exports = {
163
191
  },
164
192
  scriptsDir: path.resolve(__dirname, '..', 'scripts'),
165
193
  sources: [],
166
- suffix: '6',
194
+ suffix: '7',
167
195
  ssl: false,
196
+ db_client: 'auto',
168
197
  via: 'apache',
169
198
  volumes: ['/usr/local/bin'],
170
199
  webroot: '.',
@@ -231,12 +260,17 @@ module.exports = {
231
260
  addBuildStep(commands, options._app, options.name, 'build_internal');
232
261
  }
233
262
 
234
- // Install the desired composer version as the first `build_internal` build step
263
+ // Install the desired composer version as a `build_as_root_internal` step so it runs
264
+ // before user build steps — prevents composer from being missing if build_as_root fails
235
265
  if (options.composer_version) {
236
266
  debug('Installing composer version %s', options.composer_version);
237
267
  const commands = [`/etc/lando/service/helpers/install-composer.sh ${options.composer_version}`];
238
- const firstStep = true;
239
- addBuildStep(commands, options._app, options.name, 'build_internal', firstStep);
268
+ addBuildStep(commands, options._app, options.name, 'build_as_root_internal');
269
+ }
270
+
271
+ const dbClient = detectDatabaseClient(options, debug);
272
+ if (dbClient && phpSemver && semver.gte(phpSemver, '8.3.0')) {
273
+ addBuildStep([`/etc/lando/service/helpers/install-db-client.sh ${dbClient}`], options._app, options.name, 'build_as_root_internal');
240
274
  }
241
275
 
242
276
  // Add in nginx if we need to
@@ -1,4 +1,4 @@
1
- # docker build -t devwithlando/php:5.6-apache-6 .
1
+ # docker build -t devwithlando/php:5.6-apache-7 .
2
2
 
3
3
  FROM php:5.6-apache-stretch
4
4
 
@@ -1,4 +1,4 @@
1
- # docker build -t devwithlando/php:5.6-fpm-6 .
1
+ # docker build -t devwithlando/php:5.6-fpm-7 .
2
2
 
3
3
  FROM php:5.6-fpm-stretch
4
4
 
@@ -1,4 +1,4 @@
1
- # docker build -t devwithlando/php:7.0-apache-6 .
1
+ # docker build -t devwithlando/php:7.0-apache-7 .
2
2
 
3
3
  FROM php:7.0-apache-stretch
4
4
 
@@ -1,4 +1,4 @@
1
- # docker build -t devwithlando/php:7.0-fpm-6 .
1
+ # docker build -t devwithlando/php:7.0-fpm-7 .
2
2
 
3
3
  FROM php:7.0-fpm-stretch
4
4
 
@@ -1,4 +1,4 @@
1
- # docker build -t devwithlando/php:7.1-apache-6 .
1
+ # docker build -t devwithlando/php:7.1-apache-7 .
2
2
 
3
3
  FROM php:7.1-apache-buster
4
4
 
@@ -1,4 +1,4 @@
1
- # docker build -t devwithlando/php:7.1-fpm-6 .
1
+ # docker build -t devwithlando/php:7.1-fpm-7 .
2
2
 
3
3
  FROM php:7.1-fpm-buster
4
4
 
@@ -1,4 +1,4 @@
1
- # docker build -t devwithlando/php:7.2-apache-6 .
1
+ # docker build -t devwithlando/php:7.2-apache-7 .
2
2
 
3
3
  FROM php:7.2-apache-buster
4
4
 
@@ -1,4 +1,4 @@
1
- # docker build -t devwithlando/php:7.2-fpm-6 .
1
+ # docker build -t devwithlando/php:7.2-fpm-7 .
2
2
 
3
3
  FROM php:7.2-fpm-buster
4
4
 
@@ -1,4 +1,4 @@
1
- # docker build -t devwithlando/php:7.3-apache-6 .
1
+ # docker build -t devwithlando/php:7.3-apache-7 .
2
2
 
3
3
  FROM php:7.3-apache-bullseye
4
4
 
@@ -1,4 +1,4 @@
1
- # docker build -t devwithlando/php:7.3-fpm-6 .
1
+ # docker build -t devwithlando/php:7.3-fpm-7 .
2
2
 
3
3
  FROM php:7.3-fpm-bullseye
4
4
 
@@ -1,4 +1,4 @@
1
- # docker build -t devwithlando/php:7.4-apache-6 .
1
+ # docker build -t devwithlando/php:7.4-apache-7 .
2
2
 
3
3
  FROM php:7.4-apache-bullseye
4
4
 
@@ -1,4 +1,4 @@
1
- # docker build -t devwithlando/php:7.4-fpm-6 .
1
+ # docker build -t devwithlando/php:7.4-fpm-7 .
2
2
 
3
3
  FROM php:7.4-fpm-bullseye
4
4
 
@@ -1,4 +1,4 @@
1
- # docker build -t devwithlando/php:8.0-apache-6 .
1
+ # docker build -t devwithlando/php:8.0-apache-7 .
2
2
 
3
3
  FROM php:8.0-apache-bullseye
4
4
 
@@ -1,4 +1,4 @@
1
- # docker build -t devwithlando/php:8.0-fpm-6 .
1
+ # docker build -t devwithlando/php:8.0-fpm-7 .
2
2
 
3
3
  FROM php:8.0-fpm-bullseye
4
4
 
@@ -1,4 +1,4 @@
1
- # docker build -t devwithlando/php:8.1-apache-6 .
1
+ # docker build -t devwithlando/php:8.1-apache-7 .
2
2
 
3
3
  FROM php:8.1-apache-bookworm
4
4
 
@@ -1,4 +1,4 @@
1
- # docker build -t devwithlando/php:8.1-fpm-6 .
1
+ # docker build -t devwithlando/php:8.1-fpm-7 .
2
2
 
3
3
  FROM php:8.1-fpm-bookworm
4
4
 
@@ -1,4 +1,4 @@
1
- # docker build -t devwithlando/php:8.2-apache-6 .
1
+ # docker build -t devwithlando/php:8.2-apache-7 .
2
2
 
3
3
  FROM php:8.2-apache-bookworm
4
4
 
@@ -1,4 +1,4 @@
1
- # docker build -t devwithlando/php:8.2-fpm-6 .
1
+ # docker build -t devwithlando/php:8.2-fpm-7 .
2
2
 
3
3
  FROM php:8.2-fpm-bookworm
4
4
 
@@ -1,4 +1,7 @@
1
- # docker build -t devwithlando/php:8.3-apache-6 .
1
+ # docker build -t devwithlando/php:8.3-apache-7 .
2
+
3
+ FROM mysql:8.0 AS mysql-client-80
4
+ FROM mysql:8.4 AS mysql-client-84
2
5
 
3
6
  FROM php:8.3-apache-trixie
4
7
 
@@ -54,6 +57,18 @@ RUN \
54
57
  RUN install-php-extensions xdebug \
55
58
  && rm -f /usr/local/etc/php/conf.d/*xdebug.ini
56
59
 
60
+ # Pre-download MySQL client binaries for version-matched installs
61
+ COPY --from=mysql-client-80 /usr/bin/mysql /usr/local/mysql-client/8.0/mysql
62
+ COPY --from=mysql-client-80 /usr/bin/mysqldump /usr/local/mysql-client/8.0/mysqldump
63
+ COPY --from=mysql-client-80 /usr/bin/mysqladmin /usr/local/mysql-client/8.0/mysqladmin
64
+ COPY --from=mysql-client-84 /usr/bin/mysql /usr/local/mysql-client/8.4/mysql
65
+ COPY --from=mysql-client-84 /usr/bin/mysqldump /usr/local/mysql-client/8.4/mysqldump
66
+ COPY --from=mysql-client-84 /usr/bin/mysqladmin /usr/local/mysql-client/8.4/mysqladmin
67
+
68
+ # Ensure required MySQL client shared libraries are present
69
+ COPY --from=mysql-client-80 /usr/lib64/libmysqlclient.so* /usr/lib/
70
+ COPY --from=mysql-client-84 /usr/lib64/libmysqlclient.so* /usr/lib/
71
+
57
72
  RUN \
58
73
  chsh -s /bin/bash www-data && mkdir -p /var/www/.composer && chown -R www-data:www-data /var/www \
59
74
  && apt-get -y clean \
@@ -1,4 +1,7 @@
1
- # docker build -t devwithlando/php:8.3-fpm-6 .
1
+ # docker build -t devwithlando/php:8.3-fpm-7 .
2
+
3
+ FROM mysql:8.0 AS mysql-client-80
4
+ FROM mysql:8.4 AS mysql-client-84
2
5
 
3
6
  FROM php:8.3-fpm-trixie
4
7
 
@@ -54,6 +57,18 @@ RUN \
54
57
  RUN install-php-extensions xdebug \
55
58
  && rm -f /usr/local/etc/php/conf.d/*xdebug.ini
56
59
 
60
+ # Pre-download MySQL client binaries for version-matched installs
61
+ COPY --from=mysql-client-80 /usr/bin/mysql /usr/local/mysql-client/8.0/mysql
62
+ COPY --from=mysql-client-80 /usr/bin/mysqldump /usr/local/mysql-client/8.0/mysqldump
63
+ COPY --from=mysql-client-80 /usr/bin/mysqladmin /usr/local/mysql-client/8.0/mysqladmin
64
+ COPY --from=mysql-client-84 /usr/bin/mysql /usr/local/mysql-client/8.4/mysql
65
+ COPY --from=mysql-client-84 /usr/bin/mysqldump /usr/local/mysql-client/8.4/mysqldump
66
+ COPY --from=mysql-client-84 /usr/bin/mysqladmin /usr/local/mysql-client/8.4/mysqladmin
67
+
68
+ # Ensure required MySQL client shared libraries are present
69
+ COPY --from=mysql-client-80 /usr/lib64/libmysqlclient.so* /usr/lib/
70
+ COPY --from=mysql-client-84 /usr/lib64/libmysqlclient.so* /usr/lib/
71
+
57
72
  RUN \
58
73
  chsh -s /bin/bash www-data && mkdir -p /var/www/.composer && chown -R www-data:www-data /var/www \
59
74
  && apt-get -y clean \
@@ -1,4 +1,7 @@
1
- # docker build -t devwithlando/php:8.4-apache-6 .
1
+ # docker build -t devwithlando/php:8.4-apache-7 .
2
+
3
+ FROM mysql:8.0 AS mysql-client-80
4
+ FROM mysql:8.4 AS mysql-client-84
2
5
 
3
6
  FROM php:8.4-apache-trixie
4
7
 
@@ -54,6 +57,18 @@ RUN \
54
57
  RUN install-php-extensions xdebug \
55
58
  && rm -f /usr/local/etc/php/conf.d/*xdebug.ini
56
59
 
60
+ # Pre-download MySQL client binaries for version-matched installs
61
+ COPY --from=mysql-client-80 /usr/bin/mysql /usr/local/mysql-client/8.0/mysql
62
+ COPY --from=mysql-client-80 /usr/bin/mysqldump /usr/local/mysql-client/8.0/mysqldump
63
+ COPY --from=mysql-client-80 /usr/bin/mysqladmin /usr/local/mysql-client/8.0/mysqladmin
64
+ COPY --from=mysql-client-84 /usr/bin/mysql /usr/local/mysql-client/8.4/mysql
65
+ COPY --from=mysql-client-84 /usr/bin/mysqldump /usr/local/mysql-client/8.4/mysqldump
66
+ COPY --from=mysql-client-84 /usr/bin/mysqladmin /usr/local/mysql-client/8.4/mysqladmin
67
+
68
+ # Ensure required MySQL client shared libraries are present
69
+ COPY --from=mysql-client-80 /usr/lib64/libmysqlclient.so* /usr/lib/
70
+ COPY --from=mysql-client-84 /usr/lib64/libmysqlclient.so* /usr/lib/
71
+
57
72
  RUN \
58
73
  chsh -s /bin/bash www-data && mkdir -p /var/www/.composer && chown -R www-data:www-data /var/www \
59
74
  && apt-get -y clean \
@@ -1,4 +1,7 @@
1
- # docker build -t devwithlando/php:8.4-fpm-6 .
1
+ # docker build -t devwithlando/php:8.4-fpm-7 .
2
+
3
+ FROM mysql:8.0 AS mysql-client-80
4
+ FROM mysql:8.4 AS mysql-client-84
2
5
 
3
6
  FROM php:8.4-fpm-trixie
4
7
 
@@ -55,6 +58,18 @@ RUN \
55
58
  RUN install-php-extensions xdebug \
56
59
  && rm -f /usr/local/etc/php/conf.d/*xdebug.ini
57
60
 
61
+ # Pre-download MySQL client binaries for version-matched installs
62
+ COPY --from=mysql-client-80 /usr/bin/mysql /usr/local/mysql-client/8.0/mysql
63
+ COPY --from=mysql-client-80 /usr/bin/mysqldump /usr/local/mysql-client/8.0/mysqldump
64
+ COPY --from=mysql-client-80 /usr/bin/mysqladmin /usr/local/mysql-client/8.0/mysqladmin
65
+ COPY --from=mysql-client-84 /usr/bin/mysql /usr/local/mysql-client/8.4/mysql
66
+ COPY --from=mysql-client-84 /usr/bin/mysqldump /usr/local/mysql-client/8.4/mysqldump
67
+ COPY --from=mysql-client-84 /usr/bin/mysqladmin /usr/local/mysql-client/8.4/mysqladmin
68
+
69
+ # Ensure required MySQL client shared libraries are present
70
+ COPY --from=mysql-client-80 /usr/lib64/libmysqlclient.so* /usr/lib/
71
+ COPY --from=mysql-client-84 /usr/lib64/libmysqlclient.so* /usr/lib/
72
+
58
73
  RUN \
59
74
  chsh -s /bin/bash www-data && mkdir -p /var/www/.composer && chown -R www-data:www-data /var/www \
60
75
  && apt-get -y clean \
@@ -1,4 +1,7 @@
1
- # docker buildx build -t devwithlando/php:8.5-apache-6 .
1
+ # docker buildx build -t devwithlando/php:8.5-apache-7 .
2
+
3
+ FROM mysql:8.0 AS mysql-client-80
4
+ FROM mysql:8.4 AS mysql-client-84
2
5
 
3
6
  FROM php:8.5-apache-trixie
4
7
 
@@ -54,6 +57,18 @@ RUN \
54
57
  RUN install-php-extensions xdebug/xdebug@master \
55
58
  && rm -f /usr/local/etc/php/conf.d/*xdebug.ini
56
59
 
60
+ # Pre-download MySQL client binaries for version-matched installs
61
+ COPY --from=mysql-client-80 /usr/bin/mysql /usr/local/mysql-client/8.0/mysql
62
+ COPY --from=mysql-client-80 /usr/bin/mysqldump /usr/local/mysql-client/8.0/mysqldump
63
+ COPY --from=mysql-client-80 /usr/bin/mysqladmin /usr/local/mysql-client/8.0/mysqladmin
64
+ COPY --from=mysql-client-84 /usr/bin/mysql /usr/local/mysql-client/8.4/mysql
65
+ COPY --from=mysql-client-84 /usr/bin/mysqldump /usr/local/mysql-client/8.4/mysqldump
66
+ COPY --from=mysql-client-84 /usr/bin/mysqladmin /usr/local/mysql-client/8.4/mysqladmin
67
+
68
+ # Ensure required MySQL client shared libraries are present
69
+ COPY --from=mysql-client-80 /usr/lib64/libmysqlclient.so* /usr/lib/
70
+ COPY --from=mysql-client-84 /usr/lib64/libmysqlclient.so* /usr/lib/
71
+
57
72
  RUN \
58
73
  chsh -s /bin/bash www-data && mkdir -p /var/www/.composer && chown -R www-data:www-data /var/www \
59
74
  && apt-get -y clean \
@@ -1,4 +1,7 @@
1
- # docker buildx build -t devwithlando/php:8.5-fpm-6 .
1
+ # docker buildx build -t devwithlando/php:8.5-fpm-7 .
2
+
3
+ FROM mysql:8.0 AS mysql-client-80
4
+ FROM mysql:8.4 AS mysql-client-84
2
5
 
3
6
  FROM php:8.5-fpm-trixie
4
7
 
@@ -55,6 +58,18 @@ RUN \
55
58
  RUN install-php-extensions xdebug/xdebug@master \
56
59
  && rm -f /usr/local/etc/php/conf.d/*xdebug.ini
57
60
 
61
+ # Pre-download MySQL client binaries for version-matched installs
62
+ COPY --from=mysql-client-80 /usr/bin/mysql /usr/local/mysql-client/8.0/mysql
63
+ COPY --from=mysql-client-80 /usr/bin/mysqldump /usr/local/mysql-client/8.0/mysqldump
64
+ COPY --from=mysql-client-80 /usr/bin/mysqladmin /usr/local/mysql-client/8.0/mysqladmin
65
+ COPY --from=mysql-client-84 /usr/bin/mysql /usr/local/mysql-client/8.4/mysql
66
+ COPY --from=mysql-client-84 /usr/bin/mysqldump /usr/local/mysql-client/8.4/mysqldump
67
+ COPY --from=mysql-client-84 /usr/bin/mysqladmin /usr/local/mysql-client/8.4/mysqladmin
68
+
69
+ # Ensure required MySQL client shared libraries are present
70
+ COPY --from=mysql-client-80 /usr/lib64/libmysqlclient.so* /usr/lib/
71
+ COPY --from=mysql-client-84 /usr/lib64/libmysqlclient.so* /usr/lib/
72
+
58
73
  RUN \
59
74
  chsh -s /bin/bash www-data && mkdir -p /var/www/.composer && chown -R www-data:www-data /var/www \
60
75
  && apt-get -y clean \
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lando/php",
3
3
  "description": "A Lando plugin that provides a tight integration with PHP.",
4
- "version": "1.9.0",
4
+ "version": "1.11.0",
5
5
  "author": "Mike Pirog @pirog",
6
6
  "license": "MIT",
7
7
  "repository": "lando/php",
@@ -66,9 +66,9 @@
66
66
  "semver"
67
67
  ],
68
68
  "dist": {
69
- "integrity": "sha512-rVVcfFfqh6pLhya7NOOxI22M3OwadUGbJ30KUv5HfQy7UfcNrhQ0SrvAYsPvL5l5Lt9jSxqrzJN9TotYyOLecQ==",
70
- "shasum": "20621106d351773689ba1a2cd86d307be2734f8e",
71
- "filename": "lando-php-1.9.0.tgz",
72
- "unpackedSize": 3044415
69
+ "integrity": "sha512-DXgh9l91jzrUk7wGgfTLLdlHzWnILc+VNJzPqtiTLa6sx9APcbUTQO4ns4efDjto64+cyRYqiyMSGAxrEmP/TA==",
70
+ "shasum": "bbaaf72ebdb5eaf2e8f94157cbad92022356e662",
71
+ "filename": "lando-php-1.11.0.tgz",
72
+ "unpackedSize": 3058868
73
73
  }
74
74
  }
@@ -0,0 +1,31 @@
1
+ #!/bin/bash
2
+ # Install database client matching the detected database type/version
3
+ # Usage: install-db-client.sh <type>:<version>
4
+ # Examples:
5
+ # install-db-client.sh mysql:8.4
6
+ # install-db-client.sh mariadb:11.8
7
+
8
+ set -e
9
+
10
+ DB_CLIENT="${1:-}"
11
+ if [[ -z "$DB_CLIENT" ]]; then
12
+ echo "No database client specified, keeping defaults"
13
+ exit 0
14
+ fi
15
+
16
+ DB_TYPE="${DB_CLIENT%%:*}"
17
+ DB_VERSION="${DB_CLIENT##*:}"
18
+ SCRIPTS_DIR="$(dirname "$0")"
19
+
20
+ case "$DB_TYPE" in
21
+ mysql)
22
+ "$SCRIPTS_DIR/mysql-client-install.sh" "$DB_VERSION"
23
+ ;;
24
+ mariadb)
25
+ "$SCRIPTS_DIR/mariadb-compat-install.sh"
26
+ ;;
27
+ *)
28
+ echo "Unknown database type: $DB_TYPE"
29
+ exit 1
30
+ ;;
31
+ esac
@@ -0,0 +1,42 @@
1
+ #!/bin/bash
2
+ # Usage: mariadb-compat-install.sh
3
+ # Creates wrapper scripts to map deprecated mysql commands to mariadb equivalents
4
+ # The mariadb-client package is already installed in the base image
5
+
6
+ set -e
7
+
8
+ echo "Installing MariaDB compatibility wrappers..."
9
+
10
+ # Create wrapper scripts for each mysql* command that maps to mariadb* equivalent
11
+ for cmd in mysql mysqldump mysqladmin mysqlcheck mysqlimport mysqlshow; do
12
+ suffix="${cmd#mysql}"
13
+ mariadb_cmd="mariadb${suffix:+-}${suffix}"
14
+
15
+ if command -v "$mariadb_cmd" &> /dev/null; then
16
+ cat > "/usr/local/bin/$cmd" << EOF
17
+ #!/bin/bash
18
+ exec -a "\$0" $mariadb_cmd "\$@"
19
+ EOF
20
+ chmod +x "/usr/local/bin/$cmd"
21
+ echo " Created wrapper: $cmd -> $mariadb_cmd"
22
+ fi
23
+ done
24
+
25
+ # Create config directory if it doesn't exist
26
+ mkdir -p /etc/mysql/conf.d
27
+
28
+ # Create MySQL client config with compatibility settings
29
+ cat > /etc/mysql/conf.d/lando.cnf << 'MYCNF'
30
+ [client]
31
+ default-character-set=utf8mb4
32
+
33
+ [client-mariadb]
34
+ # Prevent SSL errors when connecting to servers without SSL
35
+ disable-ssl-verify-server-cert
36
+
37
+ [mysqldump]
38
+ # MySQL 8 uses this; MariaDB safely ignores it via loose- prefix
39
+ loose-skip-column-statistics
40
+ MYCNF
41
+
42
+ echo "MariaDB compatibility wrappers installed"
@@ -0,0 +1,62 @@
1
+ #!/bin/bash
2
+ # Install MySQL client from pre-downloaded binaries
3
+ # Usage: mysql-client-install.sh <version>
4
+ # Examples: mysql-client-install.sh 8.4, mysql-client-install.sh 8.0
5
+
6
+ set -e
7
+
8
+ VERSION="${1:-8.4}"
9
+
10
+ echo "Installing MySQL $VERSION client..."
11
+
12
+ # Map version to the closest available pre-downloaded version
13
+ # We have 8.0 and 8.4 available
14
+ case "$VERSION" in
15
+ 8.4*|8.3*)
16
+ CLIENT_VERSION="8.4"
17
+ ;;
18
+ 8.0*|8.1*|8.2*|5.7*)
19
+ CLIENT_VERSION="8.0"
20
+ ;;
21
+ *)
22
+ # Default to 8.4 for unknown versions
23
+ CLIENT_VERSION="8.4"
24
+ echo "Warning: Unknown MySQL version $VERSION, using $CLIENT_VERSION client"
25
+ ;;
26
+ esac
27
+
28
+ CLIENT_DIR="/usr/local/mysql-client/$CLIENT_VERSION"
29
+
30
+ if [ -d "$CLIENT_DIR" ]; then
31
+ # Remove MariaDB client symlinks if they exist in /usr/local/bin
32
+ rm -f /usr/local/bin/mysql /usr/local/bin/mysqldump /usr/local/bin/mysqladmin 2>/dev/null || true
33
+
34
+ # Create symlinks to the pre-downloaded MySQL client
35
+ ln -sf "$CLIENT_DIR/mysql" /usr/local/bin/mysql
36
+ ln -sf "$CLIENT_DIR/mysqldump" /usr/local/bin/mysqldump
37
+ ln -sf "$CLIENT_DIR/mysqladmin" /usr/local/bin/mysqladmin
38
+
39
+ echo "MySQL $CLIENT_VERSION client activated from pre-downloaded binaries"
40
+ else
41
+ echo "Warning: Pre-downloaded MySQL client not found at $CLIENT_DIR"
42
+ echo "Keeping default mariadb-client"
43
+ exit 0
44
+ fi
45
+
46
+ # Create config directory if it doesn't exist
47
+ mkdir -p /etc/mysql/conf.d
48
+
49
+ # Create MySQL client config with compatibility settings
50
+ cat > /etc/mysql/conf.d/lando.cnf << 'MYCNF'
51
+ [client]
52
+ default-character-set=utf8mb4
53
+
54
+ [mysqldump]
55
+ # Prevent column-statistics errors with newer mysqldump
56
+ skip-column-statistics
57
+ MYCNF
58
+
59
+ if ! mysql --version 2>/dev/null; then
60
+ echo "Error: MySQL client not available after activation"
61
+ exit 1
62
+ fi