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

Include a docker-php-ext-disable #220

Closed
k-k opened this issue Apr 13, 2016 · 10 comments
Closed

Include a docker-php-ext-disable #220

k-k opened this issue Apr 13, 2016 · 10 comments

Comments

@k-k
Copy link

k-k commented Apr 13, 2016

I saw that there is no disable script here - ideally, it'd be great to replicate both php5enmod and php5dismod functionality.

I created a disable script based on docker-php-ext-enable and am copying it in my build. The script just looks for the existence of the extension ini file and removes it - but not sure if there is a more ideal way to handle this? Willing to PR it, if there's any interest.

The use case for me was to be able to enable or disable xdebug on the fly when running PHPUnit:

docker exec -ti php sh -c "docker-php-ext-disable xdebug && vendor/bin/phpunit

@isp0000
Copy link

isp0000 commented May 2, 2016

@kmfk why not add your script as pull request?

@tianon
Copy link
Member

tianon commented May 2, 2016

I'm honestly a little -1 on adding this. Enabling an extension in a generic way is simple (requires getting extension=xxx.so into the PHP configuration somewhere). Disabling in a fully generic way is not nearly as simple, so I would actually recommend using --ini-name (from #178) to accomplish this more easily.

@shouze
Copy link
Contributor

shouze commented May 25, 2016

Yes, furthermore there's no good reason to disable an extension in fact. If you use the same container for tests/dev & production (which is pretty cool), you can imagine running php differently depending on your environment.

It's easier for example to run php php -d 'extension=xdebug.so' myscript.php when developing your app then running just php myscript.php in production.

@kodeart
Copy link

kodeart commented Jun 8, 2016

+1 It is useful if you create your own images for dev/prod. If dev extends the production image, it's great to disable something from production, i.e.

# in dev Dockerfile
FROM my-production-image
RUN docker-php-ext-disable opcache

@shouze
Copy link
Contributor

shouze commented Jun 8, 2016

@kodeart yes... but why not producing a dedicated image for dev and another one for prod? Very easy with automated builds & tags.

@pproenca
Copy link

@kmfk @tianon I've opened a pull request which introduces docker-php-ext-disable in #270

@tianon
Copy link
Member

tianon commented Dec 22, 2017

Given that #178 added --ini-name for explicitly controlling the exact filename docker-php-ext-enable creates (and that the filenames it uses are already trivially deterministic), I'm going to close this with the recommendation that users who need to disable extensions after previously enabling them simply use rm on the appropriate file (or sed, if they've added additional configuration to the file since enabling the extension). Thanks!

@timnolte
Copy link

Something of note where people may want to specifically disabled xdebug you can set the environment variable XDEBUG_MODE=off and that will turn off xdebug on-the-fly. This was my primary purposed for investigating a docker-php-ext-disable method.

@LaurentGoderre
Copy link
Member

Thanks for sharing this!

@jonpontet
Copy link

Something of note where people may want to specifically disabled xdebug you can set the environment variable XDEBUG_MODE=off and that will turn off xdebug on-the-fly. This was my primary purposed for investigating a docker-php-ext-disable method.

Or xdebug.mode=off
Reference

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 a pull request may close this issue.

9 participants