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

Specifying php.ini params as a configuration #1131

Open
vitalybaev opened this issue Jul 3, 2024 · 4 comments
Open

Specifying php.ini params as a configuration #1131

vitalybaev opened this issue Jul 3, 2024 · 4 comments

Comments

@vitalybaev
Copy link

Feature request

PHP provider from Nixpacks is great, but when I had to set some parameters (like post_max_size or upload_max_filesize) I had to append commands to nixpacks.toml to search php.ini and to append these lines there, but I believe it can be done easier.

Motivation

Changing parameters in php.ini is a common task and it would save some time and improve DX of Nixpacks

Contribution

I've already taken a glance at the source code both Nixpacks and Nix packages, but so far cannot see clear path to solve the issue, but I'm opened to help and continue to delve into source code

@Burnwood1911
Copy link

@vitalybaev ive been trying to set postmaxsize and uploadmaxfilesize but failed how did you achieve this here is my toml file

[phases.build]
dependsOn = ['install']
cmds = [
'npm run build',
]

[phases.install]
dependsOn = ['setup']
cmds = [
'mkdir -p /var/log/nginx && mkdir -p /var/cache/nginx',
'composer install --ignore-platform-reqs',
'npm ci',
]

[phases.setup]
nixPkgs = [
'(php82.withExtensions (pe: pe.enabled ++ [ pe.all.imagick ]))',
'nginx',
'libmysqlclient',
'php82Packages.composer',
'php82Extensions.imagick',
'nodejs_18',
'npm-9_x',
]

@vitalybaev
Copy link
Author

@Burnwood1911 I've ended up with this workaround in my nixpacks.toml:

[variables]
    UPLOAD_MAX_FILESIZE = '10M'
    POST_MAX_SIZE = '10M'

[phases.setup]
    cmds = ['PHP_INI_PATH=$(php --ini | grep "Additional .ini files parsed:" | cut -d: -f2 | tr -d " "); echo "PHP_INI_PATH is $PHP_INI_PATH"; echo "upload_max_filesize=10M" >> $PHP_INI_PATH; echo "post_max_size=10M" >> $PHP_INI_PATH; echo "Content of php.ini below:"; cat "$PHP_INI_PATH"']

@Burnwood1911
Copy link

It worked @vitalybaev thank you so much I spent like 6 hours trying to get this to work

@lolautruche
Copy link
Contributor

I 💯 second this issue!
We could imagine providing a php.ini in the codebase, just like nginx.conf. This is how the symfony CLI works for example.

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

3 participants