Changes to upload_max_filesize in Ubuntu php.ini will not take effect

前端 未结 9 2328
耶瑟儿~
耶瑟儿~ 2020-12-05 04:54

I have been trying for two days to increase the max filesize for file uploads via php to 10M from the default 2M. I change the php.ini file that is referenced by phpinfo to

9条回答
  •  悲哀的现实
    2020-12-05 05:36

    This message helped me:

    The newest php version installed on server does not allow global settings (such as execution time, max upload filesize, max post file size, etc.) to be changed.

    Folow these steps to resolve the issue:

    1. Eval phpinfo();
    2. Search for 'Scan this dir for additional .ini files' text in phpinfo() output
    3. It will be something like this /etc/php5/apache2/conf.d
    4. Create your user.ini file inside the dir. (/etc/php5/apache2/conf.d/user.ini)
    5. Use this ini file for custom settings.
    6. Restart the server

    File /etc/php5/apache2/conf.d/user.ini

    post_max_size = 90M
    upload_max_filesize = 50M
    

    Update 2018.06

    If you are using nginx + php-fpm your path will be something like this (use your php version in path). Create file using:

    nano /etc/php/7.0/fpm/conf.d/user.ini
    

    There are a lot of other .ini files in the conf.d directory. If you want your config to be the last included - use prefix.

    For example: 30-user.ini.

    After file creation don't forget to restart fpm:

    sudo service php7.0-fpm restart
    

提交回复
热议问题