[How to] Add additional PHP option for a domain using command line?

Created:

2016-11-16 12:58:23 UTC

Modified:

2017-08-16 18:32:33 UTC

0

Was this article helpful?


Have more questions?

Submit a request

[How to] Add additional PHP option for a domain using command line?

Applicable to:

  • Plesk 12.5 for Linux
  • Plesk 11.x for Linux
  • Plesk 12.0 for Linux
  • Plesk 12.5 for Windows

Question

It is possible to add additional PHP directives via Plesk in Home > Domains > example.com > PHP Settings** and adding configuration line to Additional configuration directives sections as follows:

GUI

Is it possible to perform such task via command line?

Resolution

Plesk has many underlying commandline utilities built for this purpose.

The site can be used, as follows:

  1. Create the file with all additional settings you need to apply to a domain ( vi can be used or any other text editor, but this simple example shows single-line configuration file):
    # 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 in php.ini .

  1. Apply the settings file:

    # 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 Additional configuration directives box in Plesk web GUI.

NOTE: Each time this command is run, the previous settings will be overwritten . Current settings for the domain can be checked by either opening the GUI page as shown above or executing the following command:

    # plesk bin site --show-php-settings example.com
General settings:
open_basedir = {WEBSPACEROOT}{/}{:}{TMP}{/}
Performance settings:
Additional directivies:
sendmail_path = /dev/null

Here it is shown that there is one additional directive already added for this domain.
  1. To revert the applied settings use the empty file as the last directive like this ( /dev/null is used as empty file equivalent):
    # plesk bin site --update-php-settings example.com -additional-settings /dev/null

More information on Plesk's Linux commandline utilities in this documentation .

Have more questions? Submit a request
Please sign in to leave a comment.