PHP Settings with .user.ini
A .user.ini
file allows you to easily customize PHP settings. Starting with Ubuntu Bionic only settings via .user.ini
are supported.
To make PHP settings, you can create a file called .user.ini
. All PHP settings defined in it will be recursively applied to the folder where the file is located.
Example
register_globals=on
upload_max_filesize="5M"
Find affected .htaccess files
To find affected files, you can use the following command:
find /home/www-*/ -type f -name .htaccess -exec grep -nH "php_" {} +
Migration from .htaccess
If you have used our old PHP stack until now, you have to migrate the PHP settings from .htaccess
to .user.ini
.
For this, you only have to remove the first keyword (php_value, php_flag) and enter the definition with [KEY]=[VALUE]
. Please surround the PHP settings in the .htaccess
file with IfModule
conditions as they will lead to issues after the migration otherwise:
.htaccess
<IfModule php7_module>
php_value include_path ".:/usr/local/lib/php"
php_flag display_errors Off
php_value upload_max_filesize 500M
</IfModule>
.user.ini
include_path=".:/usr/local/lib/php"
display_errors=Off
upload_max_filesize=500M