Memory limit, upload file size, quotes management, etc. are all PHP configuration options which change is required by various Web applications during their installation. This howto provides a command-line tool to automate the edition of PHP global settings.
This howto is tested on:
- Debian 10.0 Buster
Requirements
This howto recommends:
- biapy-updater, for automatic software updates.
- a HTTP server with PHP support, as described by Install PHP-FPM on Debian.
Installation
Detect if sudo is available (“command” is used if not):
cmdProxy='command'
command type -f 'sudo' &>'/dev/null' && cmdProxy='sudo'
Environment setup
Install the required software:
${cmdProxy} apt-get install 'php-cli'
Application’s installation
Install the tool:
${cmdProxy} wget 'https://raw.github.com/biapy/howto.biapy.com/master/php5/php-tools' \
--quiet --no-check-certificate --output-document='/usr/local/bin/php-tools'
Declare the downloaded file as executable:
${cmdProxy} chmod +x '/usr/local/bin/php-tools'
Automatic updates
Configure biapy-updater automatic updates to check for new versions of the software:
${cmdProxy} tee -a '/etc/biapy-updater.conf' <<< 'php-tools'
Next step
This howto recommends:
Usage
Get PHP option current value:
sudo php-tools --get 'post_max_size'
Analyze PHP option settings across ini files:
sudo php-tools --analyze 'post_max_size'
Force the value of a PHP option (here, post_max_size is forced to 5 Mb):
sudo php-tools --fix 'post_max_size' '5M'
Raise the value of a PHP option, if needed (here, raise post_max_size to 10Mb if existing value is lower) :
sudo php-tools --set 'post_max_size' '10M'
The options set by php-tools are stored in the “zzz-php-tools.ini” file in the PHP modular configuration folder (“/etc/php/*/mods-available”).
0 Comments