Repository navigation
build: Remove unsupported PHP versions by default, fixes #5984 - #6691
Conversation
|
Download the artifacts for this pull request:
See Testing a PR. |
cd39ebf to
272551d
Compare
| // If our PHP version is not already provided in the ddev-webserver, add it now | ||
| if _, ok := nodeps.PreinstalledPHPVersions[app.PHPVersion]; !ok { | ||
| contents = contents + fmt.Sprintf(` | ||
| ### DDEV-injected addition of not-preinstalled PHP version | ||
| RUN /usr/local/bin/install_php_extensions.sh "php%s" "${TARGETPLATFORM#linux/}"; | ||
| RUN update-alternatives --set php /usr/bin/php%s | ||
| RUN chmod ugo+rw /var/log/php-fpm.log && chmod ugo+rwx /var/run && ln -sf /usr/sbin/php-fpm%s /usr/sbin/php-fpm | ||
| RUN mkdir -p /tmp/xhprof | ||
| RUN chmod -fR ugo+w /etc/php /var/lib/php/modules /tmp/xhprof | ||
| RUN phpdismod blackfire xdebug xhprof | ||
| `, app.PHPVersion, app.PHPVersion, app.PHPVersion) | ||
| } |
There was a problem hiding this comment.
I think this block should have been added earlier.
If people do any manipulation with php (or it's packages) in pre.Dockerfile, then this change is likely to break their customization (not expected PHP version will be used), so maybe this block should be before including pre.Dockerfile?
There was a problem hiding this comment.
Works for me. I put it here because the check for ddev-webserver had already been done.
There was a problem hiding this comment.
And another advantage of earlier PHP install is when you add more packages to the web image, or make some changes in the .ddev/web-build, Docker will use the cached layer for this PHP install, so it won't rebuild the whole thing.
61181e2 to
4698571
Compare
|
I pushed the images, thanks so much for catching that @stasadev |
0c20a3e to
f7ac210
Compare
f7ac210 to
a69d1a6
Compare
|
I Tested it again with php7.4, it fails much faster (less that a minute). But it failed for php5.6: I removed The script needs to update I pushed a new commit and started a new build for ddev-php-base. |
| contents = contents + fmt.Sprintf(` | ||
| ### DDEV-injected addition of not-preinstalled PHP version | ||
| RUN /usr/local/bin/install_php_extensions.sh "php%s" "${TARGETPLATFORM#linux/}" | ||
| RUN update-alternatives --set php /usr/bin/php%s |
There was a problem hiding this comment.
I tried PHP 5.6, and Composer doesn't work because PHP binary is set too early. I think it's fine to install the packages early, but this should be moved back.
ddev config --php-version=5.6 --composer-version=2.2
Warning: command 'composer self-update --2.2' run as 'root' failed with exit code 1
There was a problem hiding this comment.
I have seen the composer update failures with php5.6... but composer just isn't going to work anyway is it with 5.6? My assumption was that it was OK, just an artifact of ancient PHP. I don't think (any version of) composer is going to be usable with 5.6 is it?
There was a problem hiding this comment.
In short, Composer uses PHP, if the current PHP is not compatible with the current Composer (which is always latest stable in our Docker image), it cannot downgrade itself.
Composer 2.2 works fine with PHP 5.6, 7.0, 7.1
The problem is not whether some PHP can use Composer or not: by default we install the latest stable version of Composer and then use the composer self-update feature, but Composer itself depends on PHP, and if the current Composer binary from which the upgrade/downgrade is done is not compatible with the current PHP binary, it will not be able to run this upgrade/downgrade.
If someone is using PHP 5.6, 7.0, 7.1, DDEV will try to install Composer every ddev start because there is a warning, the warning from log-stderr.sh doesn't show the details, because they are written to stdout:
$ ddev config --php-version=7.1 --composer-version=2.2
$ ddev start
...
Warning: command 'composer self-update --2.2' run as 'root' failed with exit code 1:
Command 'composer self-update --2.2' didn't return stderr output
...
# Composer 2.8.2 tries to downgrade itself to 2.2 but can't do it because
# update-alternatives --set php /usr/bin/php7.1
$ ddev exec composer self-update --2.2
Composer 2.3.0 dropped support for PHP <7.2.5 and you are running 7.1.33-65+0~20241104.97+debian12~1.gbpf30d7c, please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.
Failed to execute command composer self-update --2.2: exit status 1
The same config works with DDEV v1.23.5.
There was a problem hiding this comment.
Thanks so much for the careful thinking and testing. My interpretation of your suggestion is in 0acdcd1
It does remove the composer warning. I think it's likely correct and non-intrusive.
Co-authored-by: Stanislav Zhuk <[email protected]>
Co-authored-by: Stanislav Zhuk <[email protected]>
8a42d22 to
0acdcd1
Compare
stasadev
left a comment
There was a problem hiding this comment.
Looks and works great, I retested all unsupported PHP 5.6, 7.0, 7.1, 7.2, 7.3, 7.4 and 8.0 on AMD64.
|
Thanks, |
The Issue
Every new PHP version has been adding heft to the default ddev-webserver. We'd like it to be smaller, for faster download and extraction times. And we'd like it not to grow with every new year's PHP version.
How This PR Solves The Issue
Manual Testing Instructions
ddev config --php-version=7.4andddev config --php-version=5.6Automated Testing Overview
I think that all the normal test coverage remains the same. It will mean that when we test all PHP versions that the tests will be a bit slower.
Release/Deployment Notes
We need to boast about how much smaller the image is :)