Disable default PHP extensions with custom.ini
dominikkrulak opened this issue · 13 comments
Container image version: bitnami/php-fpm:7.3.11-debian-9-r8 as development
I'm trying to disable some default PHP extensions using additional custom.ini
file mounted from my host and it seems that commenting it won't take effect.
Am I right here?
Hi,
I'm afraid it's the case, as this custom.ini will be loaded by the regular php.ini. Could you try mounting the php.ini file directly?
@javsalgar It didn't occurred to me that I could overwrite it with my host php.ini file.
Anyway I downloaded the file from container's image file system to keep the context of file the same and those extensions that are commented are actually enabled according to my PHP info page.
For example extension in php.ini file downloaded from container's image file system ;extension=gd2
is commented. I don't need this extension but instead I need extension=imagick
. It's like certain extensions from this php.ini file won't take effect while commented or commented out.
Hi,
Did you mount it as explained here? https://github.com/bitnami/bitnami-docker-php-fpm#5530-0-r01-2015-11-10
@javsalgar no I didn't.
What I did after your advice was I've sh
into running phpfpm
container, located php.ini
file
and host mounted a volume.
volumes:
- /Users/domkrulak/DEV/Docker/php-fpm/7.3-prod/debian-9/app:/app:consistent
- /Users/domkrulak/DEV/Docker/php-fpm/7.3-prod/debian-9/etc/php.ini:/opt/bitnami/php/etc/php.ini
What I could:
- add extension like
extension=imagick
- edit options like
max_file_uploads = 40M
What I couldn't:
- disable extension that came as default like
;extension=gd2
which was commented when image was build. Despite that the extension is enabled
Anyway I've tried your next advice to mount to /bitnami/php-fpm/conf/
and unfortunately no effect.
volumes:
- /Users/domkrulak/DEV/Docker/php-fpm/7.3-prod/debian-9/app:/app:consistent
- /Users/domkrulak/DEV/Docker/php-fpm/7.3-prod/debian-9/etc/php.ini:/bitnami/php-fpm/conf/php.ini
Hi,
I launched the container but, as far as I know, the extension gd2 is not enabled. gd
is enabled, which is different from gd2
. I'm not expert but I tried enabling gd2 and saw that we do not ship it (it returned errors).
@javsalgar Hi,
Yes, that's right. Bad example.
I've just noticed that every extension that I uncomment in php.ini file host mounted to /opt/bitnami/php/etc/php.ini
for example extension=mysqli
gives this
NOTICE: PHP message: PHP Warning: PHP Startup: Unable to load dynamic library 'mysqli' (tried: /opt/bitnami/php/lib/php/extensions/mysqli (/opt/bitnami/php/lib/php/extensions/mysqli: cannot open shared object file: No such file or directory), ... ) in Unknown on line 0
SO
- You can only add and enable packages on top of the production image.
- You can't disable packages that come with the production image the way I was trying to do.
I'd like to get back to those Notable Changes.
When I bind mount volume to /bitnami/php-fpm/conf/
with php.ini
file and than I inspect the running container's filesystem shouldn't be the directory /bitnami/php-fpm/conf/
created?
Or I ask could any default extension be disabled in any other way I haven't tried?
Hi,
When I bind mount volume to /bitnami/php-fpm/conf/ with php.ini file and than I inspect the running container's filesystem shouldn't be the directory /bitnami/php-fpm/conf/ created?
Yes, you should see that file mounted in the container filesystem, what do you get instead? However, after inspecting the Dockerfile, I think that the /bitnami/php-fpm/conf
mount point does not work anymore. I will check with the team but, for the time being, mount it in /opt/bitnami/php/etc/php.ini
Then, even though we ship the default php.ini file, not all the extensions are included. This is the actual list
root@6d59d843b059:/opt/bitnami/php# find . | grep "[.]so"
./lib/php/extensions/opcache.so
./lib/php/extensions/imap.so
./lib/php/extensions/pdo_pgsql.so
./lib/php/extensions/pgsql.so
./lib/php/extensions/pdo_dblib.so
./lib/php/extensions/memcached.so
./lib/php/extensions/apcu.so
./lib/php/extensions/maxminddb.so
@javsalgar Hi,
Yes, you should see that file mounted in the container filesystem, what do you get instead?
In the running container filesystem no such directory is created.
Also I've checked for mounted volume with other images like NGINX and yes, there is directory bitnami
created within nginx's container filesystem.
Thanks
Hi @DomKrulak,
I am retaking this from here. I am not very sure of the current status of this issue.
Could you tell me you got it fixed ?
Hi @rafariossaa,
Could you tell me you got it fixed ?
No I didn't. I've moved on to other things as disabling default extensions isn't big issue.
But I will get back to this.
Ok, just add a comment again in this thread when you want to retake this.
This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.
Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.