Skip to content

Commit

Permalink
feat: change php default version to 8.2, fixes ddev#5767
Browse files Browse the repository at this point in the history
  • Loading branch information
rfay committed Feb 13, 2024
1 parent 3a1bcf9 commit dbb58a5
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/xdebug_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestCmdXdebug(t *testing.T) {

// TestDdevXdebugEnabled has already tested enough versions, so limit it here.
// and this is a pretty limited test, doesn't do much but turn on and off
phpVersions := []string{nodeps.PHP81, nodeps.PHP82}
phpVersions := []string{nodeps.PHP82, nodeps.PHP83}

pwd, _ := os.Getwd()
v := TestSites[0]
Expand Down
2 changes: 1 addition & 1 deletion containers/ddev-php-base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ RUN apt-get -qq install --no-install-recommends --no-install-suggests -y \
### Build ddev-php-base, which is the base for ddev-php-prod and ddev-webserver-*
### This combines the packages and features of DDEV’s ddev-webserver and PHP image
FROM base AS ddev-php-base
ARG PHP_DEFAULT_VERSION="8.1"
ARG PHP_DEFAULT_VERSION="8.2"
ENV DDEV_PHP_VERSION=$PHP_DEFAULT_VERSION
ENV PHP_VERSIONS="php5.6 php7.0 php7.1 php7.2 php7.3 php7.4 php8.0 php8.1 php8.2 php8.3"
ENV PHP_INI=/etc/php/$PHP_DEFAULT_VERSION/fpm/php.ini
Expand Down
8 changes: 4 additions & 4 deletions containers/ddev-webserver/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ RUN chmod -f ugo+rwx /usr/local/bin /usr/local/bin/composer
### Build ddev-webserver-dev-base from ddev-webserver-base
FROM ddev-webserver-base as ddev-webserver-dev-base
ENV CAROOT /mnt/ddev-global-cache/mkcert
ENV PHP_DEFAULT_VERSION="8.1"
ENV PHP_DEFAULT_VERSION="8.2"

RUN wget -q -O - https://packages.blackfire.io/gpg.key | apt-key add -
RUN echo "deb http://packages.blackfire.io/debian any main" > /etc/apt/sources.list.d/blackfire.list
Expand Down Expand Up @@ -164,7 +164,7 @@ RUN update-alternatives --set php /usr/bin/php${PHP_DEFAULT_VERSION}
### But for historical reasons, it's just ddev-webserver
### Build ddev-webserver by turning ddev-webserver-dev-base into one layer
FROM scratch as ddev-webserver
ENV PHP_DEFAULT_VERSION="8.1"
ENV PHP_DEFAULT_VERSION="8.2"
ENV NGINX_SITE_TEMPLATE /etc/nginx/nginx-site.conf
ENV APACHE_SITE_TEMPLATE /etc/apache2/apache-site.conf
ENV TERMINUS_CACHE_DIR=/mnt/ddev-global-cache/terminus/cache
Expand Down Expand Up @@ -192,7 +192,7 @@ CMD ["/start.sh"]
### This image is aimed at actual hardened production environments
FROM ddev-webserver-base as ddev-webserver-prod-base
ENV CAROOT /mnt/ddev-global-cache/mkcert
ENV PHP_DEFAULT_VERSION="8.1"
ENV PHP_DEFAULT_VERSION="8.2"
ARG TARGETPLATFORM

RUN wget -q -O - https://packages.blackfire.io/gpg.key | apt-key add -
Expand Down Expand Up @@ -271,7 +271,7 @@ RUN update-alternatives --set php /usr/bin/php${PHP_DEFAULT_VERSION}
### Build ddev-webserver-prod, the hardened version of ddev-webserver-base
### (Withut dev features, single layer)
FROM scratch as ddev-webserver-prod
ENV PHP_DEFAULT_VERSION="8.1"
ENV PHP_DEFAULT_VERSION="8.2"
ENV NGINX_SITE_TEMPLATE /etc/nginx/nginx-site.conf
ENV APACHE_SITE_TEMPLATE /etc/apache2/apache-site.conf
ENV TERMINUS_CACHE_DIR=/mnt/ddev-global-cache/terminus/cache
Expand Down
2 changes: 1 addition & 1 deletion docs/content/developers/project-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ To add a new project type:
* `apptypeSettingsPaths` returns the paths for the main settings file and the extra settings file that DDEV may create (like settings.ddev.php for Drupal).
* `appTypeDetect` is a function that determines whether the project is of the type you’re implementing.
* `postImportDBAction` can do something after db import. I don’t see it implemented anywhere.
* `configOverrideAction` can change default config for your project type. For example, magento2 now requires `php8.1`, so a `configOverrideAction` can change the php version.
* `configOverrideAction` can change default config for your project type. For example, your CMS may require `php8.3`, so a `configOverrideAction` can change the php version.
* `postConfigAction` gives a chance to do something at the end of config, but it doesn’t seem to be used anywhere.
* `postStartAction` adds actions at the end of [`ddev start`](../users/usage/commands.md#start). You'll see several implementations of this, for things like creating needed default directories, or setting permissions on files, etc.
* `importFilesAction` defines how [`ddev import-files`](../users/usage/commands.md#import-files) works for this project type.
Expand Down
1 change: 0 additions & 1 deletion docs/content/users/extend/customizing-images.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ For example, a Dockerfile might want to build an extension for the configured PH
ENV extension=xhprof
ENV extension_repo=https://github.com/longxinH/xhprof
ENV extension_version=v2.3.8
# For versions <= DDEV v1.21.4 you must also declare DDEV_PHP_VERSION yourself: ENV DDEV_PHP_VERSION=8.1

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y -o Dpkg::Options::="--force-confnew" --no-install-recommends --no-install-suggests autoconf build-essential libc-dev php-pear php${DDEV_PHP_VERSION}-dev pkg-config zlib1g-dev
RUN mkdir -p /tmp/php-${extension} && cd /tmp/php-${extension} && git clone ${extension_repo} .
Expand Down
4 changes: 2 additions & 2 deletions pkg/ddevapp/ddevapp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -973,8 +973,8 @@ func TestDdevXdebugEnabled(t *testing.T) {
t.Errorf("Aborting Xdebug check for php%s: %v", v, err)
continue
}
// PHP 7.2 through 8.2 get Xdebug 3.0+
if nodeps.ArrayContainsString([]string{nodeps.PHP72, nodeps.PHP73, nodeps.PHP74, nodeps.PHP80, nodeps.PHP81, nodeps.PHP82}, app.PHPVersion) {
// PHP 7.2 through 8.3 get Xdebug 3.0+
if nodeps.ArrayContainsString([]string{nodeps.PHP72, nodeps.PHP73, nodeps.PHP74, nodeps.PHP80, nodeps.PHP81, nodeps.PHP82, nodeps.PHP83}, app.PHPVersion) {
assert.Contains(stdout, "xdebug.mode => debug,develop => debug,develop", "xdebug is not enabled for %s", v)
assert.Contains(stdout, "xdebug.client_host => host.docker.internal => host.docker.internal")
} else {
Expand Down
2 changes: 1 addition & 1 deletion pkg/ddevapp/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const ConfigInstructions = `
# docroot: <relative_path> # Relative path to the directory containing index.php.
# php_version: "8.1" # PHP version to use, "5.6", "7.0", "7.1", "7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3"
# php_version: "8.2" # PHP version to use, "5.6", "7.0", "7.1", "7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3"
# You can explicitly specify the webimage but this
# is not recommended, as the images are often closely tied to DDEV's' behavior,
Expand Down
2 changes: 1 addition & 1 deletion pkg/nodeps/php_values.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const (
)

// PHPDefault is the default PHP version, overridden by $DDEV_PHP_VERSION
const PHPDefault = PHP81
const PHPDefault = PHP82

// ValidPHPVersions should be updated whenever PHP versions are added or removed, and should
// be used to ensure user-supplied values are valid.
Expand Down

0 comments on commit dbb58a5

Please sign in to comment.