How to set php_flag for each directory using php-fpm?

My problem

I want to disable the php engine in a specific folder where users can upload files, but I cannot figure it out.

PHP Version: 5.5.26

PHP mode: php-fpm (FastCGI Process Manager)

Apache Version: 2.2.29

( Server: Synology DS212j - DSM 5.2)

Anything else you need to know?


What I have tried so far:

Disconnect from .htaccess file

This is not supported by php-fpm (and some other modes), it gives a 500 error, write:

Invalid command 'php_value', perhaps mis-spelled or defined by a module not included in the server configuration.

Per-directory php.ini

php.ini ( php.ini ), . PHP . , , php.ini, .user.ini, .

php.ini

php.ini,

[path=/path/to/secure/dir]
engine = off
max_execution_time = 300

phpinfo() max_execution_time, 300 ( ), ( , phpinfo()).

php-fpm

php-fpm, , /vhost, ?

vhost

vhosts ( , ?), <Directory /path/to/secure/dir>, , .


Paniques HUGE. .htaccess-file php ( ), php_flag engine off.

+4
2

.htaccess:

<Files "*.php">
  SetHandler none
  SetHandler default-handler
  Options -ExecCGI
  RemoveHandler .php
</Files>
<IfModule mod_php5.c>
  php_flag engine off
</IfModule>

php-fpm, mod_php.

0

- httpd.conf:

<Directory "/path/to/secure/dir">
<Files "*.*">
SetHandler !
</Files>
</Directory>

HTT Hardrain, : Apache: php

0

Source: https://habr.com/ru/post/1599567/


All Articles