• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Resolved How to update default open_basedir for all websites?

macandcheese

New Pleskian
Server operating system version
AlmaLinux release 8.8 (Sapphire Caracal)
Plesk version and microupdate number
Plesk Obsidian 18.0.52.3
Dear Plesk community,

TLDR: How can we update PHP's default open_basedir for multiple domains at once?

For all domains on our 10+ Plesk servers, we're trying to configure PHP's auto_prepend_file to intercept fatal errors and send them to cloud logging.
However, most of the domains also have PHP's open_basedir setting enabled for security.
To make auto_prepend_file work, open_basedir needs to be changed to {WEBSPACEROOT}{/}{:}{TMP}{/}{:}/path/to/prependedstuff/.

Every domain uses the default setting:
1686712262657.png

...and ideally what I'd do is change that default in a single location to update all domains at once. This however seems impossible, because:
  • PHP Settings > php.ini can't be used here, because every domain has a different {WEBSPACEROOT}.
  • Service Plan > PHP Settings > Update & Sync has no effect; existing domains' open_basedir doesn't get updated.
  • Restricted Mode Settings > PHP Settings similarly has no effect on existing domains.
Any ideas, like changing the psa database maybe? Thanks in advance.

Some additional details:
- Most servers use LiteSpeed
- Servers use a mix of fastcgi and php-fpm
 
1) Make a backup of the psa database

2) Update PHP configuration in database:
plesk db
Code:
> use psa;
> UPDATE `psa`.`PhpSettingsParameters` SET value='<your new complete open_basedir entry>' WHERE name LIKE 'open_basedir';
> quit;

3) Apply PHP settings to domains using "/usr/local/psa/bin/domain --update-php-settings <domain name>". For example:
plesk bin domain -l | while read domain_name; do /usr/local/psa/bin/domain --update-php-settings $domain_name; done
Depending on the number of domains, this can take a while to complete, probably around 1 to 2 seconds per domain.
 
1) Make a backup of the psa database

2) Update PHP configuration in database:
plesk db
Code:
> use psa;
> UPDATE `psa`.`PhpSettingsParameters` SET value='<your new complete open_basedir entry>' WHERE name LIKE 'open_basedir';
> quit;

3) Apply PHP settings to domains using "/usr/local/psa/bin/domain --update-php-settings <domain name>". For example:
plesk bin domain -l | while read domain_name; do /usr/local/psa/bin/domain --update-php-settings $domain_name; done
Depending on the number of domains, this can take a while to complete, probably around 1 to 2 seconds per domain.

One more question - is it also possible to (programmatically) update the defaults set in the following places?
  • Service Plan > * > PHP Settings > Update & Sync
  • Restricted Mode Settings > PHP Settings
 
Back
Top