Skip to content
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

Add native support for ext disable/reenable #1281

Closed
wants to merge 1 commit into from

Conversation

mvorisek
Copy link
Contributor

Close #1277

renaming .ini to .ini-disabled is safe, only *.ini files are scanned https://github.com/php/php-src/blob/ac1c2dcd6aef087cc87e55dd4d9e8a198bea1fb5/main/php_ini.c#L674

this native ext disable support maintain the original ext config for possible future ext (re)enable

@mvorisek mvorisek marked this pull request as ready for review March 30, 2022 14:38
@mvorisek
Copy link
Contributor Author

mvorisek commented Feb 3, 2024

What is the feedback on this PR?

@mvorisek
Copy link
Contributor Author

Hi @tianon and @yosifkit. I want to rebase this PR if you will give me the green light, if not, please share briefly why you do not want this and I will close this PR.

The usecase is that in a single Dockerfile or CI workflow, there is a need to disable some extensions temporary. Curently there is not native and elegant way to do it.

@yosifkit
Copy link
Member

We greatly appreciate the time that you've put in to this PR. At this time, we do not want to add more functionality to the docker-php-ext-* scripts nor do we want to add more scripts. We try to represent an install of php as close to upstream recommendations as we can and adding more to the scripts just increases the differences and maintenance overhead on top of all that we, regrettably, already have.

We instead recommend that users utilize the --ini-name flag if they want to be able to disable/re-enable an extension. The following example only embeds the knowledge that the ini's are stored in $PHP_INI_DIR/conf.d/ and I don't foresee a reason to for us to change it, but users could also use find to get the location of the ini file that they want to change.

ENV iniName dev-extensions.ini
# could probably get clever with a space separated string in the ENV ^ and then loop over many iniNames
RUN set -eux; \
	# install the extension already disabled
	docker-php-ext-install --ini-name "$iniName-disabled" mysqli

# then enable it when needed
RUN set -eux; \
	iniFullPath="$PHP_INI_DIR/conf.d/$iniName"; \
	mv "$iniFullPath-disabled" "$iniFullPath"; \
	# do the things that need it enabled 
	# ...
	# then restore the disabled
	mv "$iniFullPath" "$iniFullPath-disabled";

@yosifkit yosifkit closed this Mar 14, 2025
@mvorisek mvorisek deleted the impl_disable branch March 15, 2025 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add docker-php-ext-disable
2 participants