Applicable to:
- Plesk for Linux
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.
- Connect to the server via SSH
- Create dom.list file with list of domains:
# plesk bin domain -l > dom.list
-
Create
my_file_add
file with required setting. For example, withdisable_functions
directive:CONFIG_TEXT: disable_functions = "proc_open,proc_terminate,curl_exec,curl"
-
Run the utility in a loop for all domains from
dom.list
file:# cat dom.list |while read i; do plesk bin site --update-php-settings $i -additional-settings my_file_add; echo "$i - done"; done
Comments
0 comments
Please sign in to leave a comment.