Plesk

How to change PHP parameter for all domains on Plesk server?

Question

How to change PHP parameter for all domains?

For example, change open_basedir parameter for all domains?

Answer

Warning: current example is for changing open_basedir value to none. Select another value if needed.

For already created domains:

Note: the further instructions are intended for server administrators with direct RDP/SSH access to the server.
If direct SSH/RDP access to the server is not possible, contact server administrator for further assistance.

Click here to reveal information for Linux.

  1. Connect to the server using SSH.

  2. Create a list of domains:

    # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql psa -uadmin -Ne"select name from domains where htype='vrt_hst'" > /root/list.txt

  3. Create a php.txt file with the needed open_basedir configuration, e.g:

    open_basedir = none

    Note: the above configuration depending on the needs.

  4. Run the following command to apply settings from php.txt created on the previous step:

    # cat /root/list.txt | while read dom; do /usr/local/psa/bin/site --update-php-settings $dom -settings /root/php.txt;done

Click here to reveal information for Windows.

  1. Connect to the server via RDP.

  2. Create a list of domains:

    C:> plesk db -Ne"select name from domains where htype='vrt_hst'" > C:list.txt

  3. Create a php.txt file with the needed open_basedir configuration, e.g:

    open_basedir = none

    Note: the above configuration depending on the needs.

  4. Run the following command to apply settings from php.txt created on the previous step:

    C:> for /f "skip=1 tokens=1" %a in (C:list.txt) do @"%plesk_cli%site.exe" --update-php-settings %a -settings C:php.txt

 

 

For new domains:

Set up open_basedir value to none at Service Plans > plan_name > PHP Settings.

Note: Service Plans are available for Web Host and Web Pro editions only.

Alternatively, modify panel.ini configuration file:

  1. Log into Plesk.

  2. Install the Panel.ini Editor extension in Plesk How to manage Plesk extensions (install, disable, remove, update)

  3. Go to Plesk > Extensions > My Extensions > Panel.ini Editor > Go To Extension > Editor.

  4. Set the default open_basedir to none:

    if there is no [php] section in Panel.ini, add the following:

    [php]
    settings.general.open_basedir.default="none"

    Otherwise, add the directive to [php] section:

    settings.general.open_basedir.default="none"

  5. Click Save:

Additional information

PHP parameters customization.

How to change/customize PHP settings?

Exit mobile version