Reputation: 13
So we are currently working on a 1 webserver multiple PHP-FPM setup in Docker-Compose locally and Docker-Swarm on prod., and we started to feel like the job is done then we run into some issues with php-fpm when we wanted to load some image we got:
NOTICE: Access to the script '/app/DSDPersonnel/test.jpg' has been denied (see security.limit_extensions)
Then I started googling around and found out it's a php fpm error in www.conf
or php-fpm.conf
, so I tried to edit those.
Since we running this setup on docker I tried the following solutions:
RUN echo security.limit_extensions = FALSE > /etc/php/fpm/php-fpm.conf
this just completly break the container.
Tried to pass it as a fastcgi_param
on nginx fastcgi_param PHP_VALUE "security.limit_extensions = FALSE";
which resulted in:
ERROR: Passing INI directive through FastCGI: unable to set 'security.limit_extensions'
and then after page loading got the same:
NOTICE: Access to the script '/app/DSDPersonnel/test.jpg' has been denied (see security.limit_extensions)
tried to tinkering with fast_cgi params
without any success.
tried to insert include=/etc/php-fpm.d/*.conf
to php-fpm.conf
then load ext.conf
which contains security.limit_extensions = FALSE
Now I am completely out of ideas. Here is our nginx conf:
location /DSDPersonnel {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass dsd-personnel:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
Any suggestion is useful but we don't want to move the images from the php container to the nginx because of the multiple container setup.
Upvotes: 1
Views: 2202
Reputation: 46
Editing www.conf should do the trick I tested it right now on php-fpm 7, uncomment the line
security.limit_extensions = .php .php3 .php4 .php5
and add it the .jpg extension
security.limit_extensions = .php .php3 .php4 .php5 .jpg
or uncomment it, and remove any extension in your dockerfile (beware of security risk):
RUN echo "security.limit.extensions =" >> /usr/local/etc/php-fpm.d/www.conf
(be careful of your www.conf location, and the >> that will append to file, instead of completely overwriting it)
Upvotes: 3