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

Want to modify php.ini #50

Open
dharmeshmp opened this issue Jan 21, 2023 · 2 comments
Open

Want to modify php.ini #50

dharmeshmp opened this issue Jan 21, 2023 · 2 comments

Comments

@dharmeshmp
Copy link

Hi,

In one of my project i need to update value of serialize_precision to 16 in php.ini
I am not able to figure it out how I can change this value using your image.

Can you please guide me?

Thanks in advance.

@tiredofit
Copy link
Owner

There are lots and lots of ways, but I think the easiest way without building your own image would be to take advantage of my "custom script" support.

By setting the following CONTAINER_POST_INIT_SCRIPT=/somewhere/on/filesystem.sh You could map a script to that location and inside the script could do the following

#!/bin/bash

source /assets/functions/20-php-fpm # Pull my container functions to find the PHP folder nicely
php_bootstrap # Set a new environment variable called 'php_prefix'

sed -i 's|serialize_precision =.*|serialize_precision = 18|g' /etc/"${php_prefix}"/php.ini # Modify _any_ value of serialize precision to the one you want.

This will run after all the other scripts have fun to configure Nginx and PHP-FPM.

There is another way which could work:

Setting an environment variable of
CONTAINER_POST_INIT_COMMAND="source /assets/functions/20-php-fpm; sed -i 's|serialize_precision =.*|serialize_precision = 18|g' /etc/$${php_prefix}/php.ini" should theoretically work, having it run without having to map a script, however I think the scripts are more flexible to do other things to override settings.

I dont have the ability to scan a seperate folder for directives at this time, but don't see why I couldn't in the future.

@dharmeshmp
Copy link
Author

Hi @tiredofit

Thanks for the solution. I implemented your recommended solution and it's working fine.

Have done some modifications to your script.

#!/bin/bash

source /assets/functions/20-php-fpm # Pull my container functions to find the PHP folder nicely
phpfpm_bootstrap # Set a new environment variable called 'php_prefix'

sed -i 's|serialize_precision =.*|serialize_precision = -1|g' "${php_prefix}"php.ini # Modify _any_ value of serialize precision to the one you want.

phpfpm_bootstrap instead of php_bootstrap
"${php_prefix}"php.ini instead of /etc/"${php_prefix}"/php.ini

Thanks again.

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

No branches or pull requests

2 participants