• Hi, Pleskians! We are running a UX testing of our upcoming product intended for server management and monitoring.
    We would like to invite you to have a call with us and have some fun checking our prototype. The agenda is pretty simple - we bring new design and some scenarios that you need to walk through and succeed. We will be watching and taking insights for further development of the design.
    If you would like to participate, please use this link to book a meeting. We will sent the link to the clickable prototype at the meeting.
  • 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!
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

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