How to correctly use `.user.ini`-file in PHP?

后端 未结 3 1032
野性不改
野性不改 2021-02-19 18:52

In my working directory I have two files: index.php and .user.ini:

.user.ini:

display_errors=on

; http://be2.php.         


        
相关标签:
3条回答
  • 2021-02-19 19:15

    In the documentation it says:

    These files are processed only by the CGI/FastCGI SAPI

    and

    If you are using Apache, use .htaccess files for the same effect.

    So if you run PHP as an Apache module, from the commandline, or using the builtin-Server, the .user.ini-files are not processed.

    To find out your Server API, simply generate a PHP script with the following content and call it in your webbrowser:

    <? phpinfo();
    
    0 讨论(0)
  • 2021-02-19 19:18

    instead of use .htaccess for php config , u can create .user.ini file and put setting (without any indent or space) . for example my .user.ini config is:

    max_execution_time =600
    upload_max_filesize=200M
    post_max_size=200M
    memory_limit=256M 
    
    0 讨论(0)
  • 2021-02-19 19:33

    According to http://php.net/manual/en/configuration.file.per-user.php

    Check user_ini.filename in your main php.ini to make sure it's not blank and it is indeed parsed. If its value is blank then PHP doesn't scan at all.

    Also see the value of user_ini.cache_ttl

    Please take a look at

    php.net manual

    Also check this question out Loading a .user.ini PHP conf file using the PHP 5.4 internal server?

    0 讨论(0)
提交回复
热议问题