Skip to content

set MySQL to 5.5.62 on PHP 7.4 #214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: 1.10.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

# [1.10.0] - 2025-06-13
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any breaking change should be a major version to properly follow semver, e.g. 2.0.0

- Breaking Minor Change - On PHP 7.4 MySQL version to 5.5.62 to align with WordPress minimum requirements. The version of MySQL can be overridden using a version of PHP that is not 7.4, by setting the `SLIC_DB_IMAGE` environment variable explicitly or by setting the `SLIC_DB_NO_MIN` environment variable to a non falsy value.

# [1.9.2] - 2025-05-14
- Restored the `selenium/standaolone-crome` image to version `3.141.59` from `4.27.0-20241225` to ensure compatibility with older PHP driver versions.
- Fixed - Restored the `selenium/standaolone-crome` image to version `3.141.59` from `4.27.0-20241225` to ensure compatibility with older PHP driver versions.

# [1.9.1] - 2025-04-15
- Fixed - Better detection of ARM64 architecture in `is_arm64` function.
Expand Down
6 changes: 4 additions & 2 deletions slic-stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ volumes:
services:

db:
image: mariadb:10.7.8
image: ${SLIC_DB_IMAGE:-mariadb:10.7.8}
# Not specifying a platform will ignore the setting and use the current platform.
platform: ${SLIC_DB_PLATFORM:-}
networks:
- slic
ports:
Expand Down Expand Up @@ -120,7 +122,7 @@ services:
- "${host:-host}:host-gateway"

chrome:
image: ${SLIC_CHROME_CONTAINER:-selenium/standalone-chrome:3.141.59}
image: ${SLIC_CHROME_IMAGE:-selenium/standalone-chrome:3.141.59}
networks:
- slic
depends_on:
Expand Down
2 changes: 1 addition & 1 deletion slic.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
] );

$cli_name = 'slic';
const CLI_VERSION = '1.9.2';
const CLI_VERSION = '1.10.0';

// If the run-time option `-q`, for "quiet", is specified, then do not print the header.
if ( in_array( '-q', $argv, true ) || ( in_array( 'exec', $argv, true ) && ! in_array( 'help', $argv, true ) ) ) {
Expand Down
41 changes: 39 additions & 2 deletions src/slic.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,9 @@ function setup_slic_env( $root_dir, $reset = false ) {
}
}

// All the possible env files have been loaded, time to set the db image depending on the PHP version.
setup_db_env();

/*
* Set the host env var to make xdebug work on Linux with host.docker.internal.
* This will already be set on Mac/Windows, and overriding it would break things.
Expand Down Expand Up @@ -1676,10 +1679,10 @@ function is_arm64() {
function setup_architecture_env() {
if ( is_arm64() ) {
putenv( 'SLIC_ARCHITECTURE=arm64' );
putenv( 'SLIC_CHROME_CONTAINER=seleniarm/standalone-chromium:4.20.0-20240427' );
putenv( 'SLIC_CHROME_IMAGE=seleniarm/standalone-chromium:4.20.0-20240427' );
} else {
putenv( 'SLIC_ARCHITECTURE=x86' );
putenv( 'SLIC_CHROME_CONTAINER=selenium/standalone-chrome:3.141.59' );
putenv( 'SLIC_CHROME_IMAGE=selenium/standalone-chrome:3.141.59' );
}
}

Expand Down Expand Up @@ -1722,3 +1725,37 @@ function cache( $path = '/', $create = true ) {

return $full_path;
}

function setup_db_env() {
$php_version = getenv( 'SLIC_PHP_VERSION' ) ?: '7.4';

if ( $php_version !== '7.4' ) {
// MySQL 5.5 is only used for PHP 7.4.
return;
}

// Was a db image explicitly set?
$mysql_image = getenv( 'SLIC_DB_IMAGE' ) ?: null;

if ( $mysql_image ) {
// The db image was explicitly set, we're not overriding it.
return;
}

$db_no_min = getenv( 'SLIC_DB_NO_MIN' ) ?: false;

if ( $db_no_min ) {
// The env var not to use the minimum db image was set, we're not overriding it.
return;
}

/*
* Use the latest version of the minimum database version supported by WordPress.
* The image only comes in linux/amd64, so we need to use the x86 image.
* arm64 machines that cannot run it will fail at the docker level with a message.
* The function is not trying to guess what combination of architecture and OS will
* support it, and it should not.
*/
putenv( 'SLIC_DB_IMAGE=mysql:5.5.62' );
putenv( 'SLIC_DB_PLATFORM=linux/amd64' );
}