3

I have Apache with PHP installed (on Windows) and run as fastCGI.
My php.ini has this value, upload_max_filesize = 2M.

I override this value in .user.ini file to 10M.

Every thing works fine until the folder level is deeper than 2 level.
For example:
If I put .user.ini file into www root.
http://localhost/ -> ini_get('upload_max_filesize') result is 10M
http://localhost/test -> ini_get('upload_max_filesize') result is 10M
http://localhost/test/lv2 -> ini_get('upload_max_filesize') result is 10M
http://localhost/test/lv2/lv3 -> ini_get('upload_max_filesize') result becomes 2M which is php.ini value and this folder has no .user.ini file.
These are not in virtual directory.

How to make .user.ini file works in deeper level of folder?


edited: add httpd.conf for php

<IfModule fcgid_module>
    FcgidInitialEnv PHPRC "C:/wwwserver/php/php5.6"
    FcgidInitialEnv PATH "C:/wwwserver/php/php5.6;C:/WINDOWS/system32;C:/WINDOWS;C:/WINDOWS/System32/Wbem;C:/Program Files (x86)/ImageMagick-6.9.3-Q16;"
    FcgidInitialEnv SystemRoot "C:/Windows"
    FcgidInitialEnv SystemDrive "C:"
    FcgidInitialEnv TEMP "C:/WINDOWS/Temp"
    FcgidInitialEnv TMP "C:/WINDOWS/Temp"
    FcgidInitialEnv windir "C:/WINDOWS"
    FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000
    FcgidIOTimeout 64
    FcgidConnectTimeout 16
    FcgidMaxRequestsPerProcess 500
    FcgidMaxRequestLen 30000000

    <Files ~ "\.php$">
        AddHandler fcgid-script .php
        FcgidWrapper C:/wwwserver/php/php5.6/php-cgi.exe .php
    </Files>
</IfModule>

Reference: https://www.apachelounge.com/viewtopic.php?p=22141

vee
  • 4,506
  • 5
  • 44
  • 81
  • 1
    I had similar problems due to extra trailing slash in Apache config. It changed $_SERVER['SCRIPT_FILENAME'] which ultimately lead to freaky .user.ini behaviour. Check http://stackoverflow.com/a/41879334/528020 – seven Jan 26 '17 at 21:17
  • @seven But I'm on Windows. – vee Jan 27 '17 at 03:00
  • on windows, you can have this issue as well. check phpinfo and report back what does SCRIPT_FILENAME say. – seven Jan 27 '17 at 17:06
  • C:/Users/xxx/my-sites/info.php As I said and it seems nothing wrong. I don't think it is because slash in my case. And there is no extra slash in the configuration. – vee Jan 27 '17 at 20:45
  • I wonder if this happens on 7.0 on windows as well? It seem that there are some open issues with current implementation of php_cgi_ini_activate_user_config. they kinda explain your situation https://bugs.php.net/bug.php?id=69436. Also this, however I was unable to find specific bug fixes in bug track http://serverfault.com/questions/441855/custom-php-ini-files-for-iis7 – seven Jan 27 '17 at 23:43
  • 1
    @seven This was fixed since PHP 7.3.19 thanks. :-) – vee Feb 08 '22 at 04:52

0 Answers0