PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, January 22, 2022

[FIXED] Change a value in php.ini using docker with an alpine php image

 January 22, 2022     alpine, docker, laravel, php     No comments   

Issue

I have a PHP application running on docker and based on php:7.3-alpine3.9

For a big form, I am posting more than 1000 inputs, and I not only I get the error

Warning: Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. in Unknown on line 0`

but worst, only 1000 input are passed to the backend

So it looks like I'd need to change the max_input_vars in the php.ini, but how can I do that ?


Solution

Usually, there is some kind of configuration directory that is scanned for further files. Try to place a file containing your local settings there, like the following:

php.ini.local:

max_input_vars = 20000

in your Dockerfile:

FROM php:7.3-alpine3.9

# Project-specific ini settings
COPY ./php-ini-overrides.ini /etc/php7/conf.d/

Another way could be to mount that single file through a Docker volume (this keeps the container configuration cleaner and is more simple if you don't want to use a Dockerfile for other purposes; additionally, you don't need to update the container when changing the configuration, but only restart it):

volumes:
  - ./php-ini-overrides.ini:/etc/php7/conf.d/php-ini-overrides.ini

This will work the best way, as you don't have to modify any existing file or keep track of changes from the upstream container

As a short hint: if the solution does not work directly, check whether you need to adjust the folder to put that file into. Another base image might place that folder to another location



Answered By - Nico Haase
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing