Question
How to add additional PHP directives for a domain in Plesk via command line?
Resolution
-
Connect to the server via SSH
-
Create the file with all additional settings that will be applied to the domain (
vi
can be used or any other text editor, but this simple example shows single-line configuration file).
For example, it is required to add the directive ‘sendmail_path = "/dev/null"
‘:# echo ‘sendmail_path = “/dev/null”‘ > nomail.ini # this directive disables sending mail via PHP
Note: any directive, which is valid in
php.ini
can be specified, using the same format as inphp.ini
. -
Apply the settings via the command:
# plesk bin site –update-php-settings example.com -additional-settings nomail.ini
It will give the same effect as if the contents of the specified file were copied to the Domains > example.com > PHP Settings > Additional configuration directives box in Plesk web GUI.
Note: Each time this command is run, the previous settings will be overwritten.