• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • 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.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Question Query to check PHP settings for domains

nuno.pereira

New Pleskian
Server operating system version
CentOS Linux release 7.9.2009 (Core)
Plesk version and microupdate number
Plesk Obsidian Version 18.0.46
Hi all.

According to the article in https://support.plesk.com/hc/en-us/articles/115001152233, the PHP settings can be changed in domain, service plan or globally.

I'm trying to figure out a way to determine what is the configuration of disable_functions in the PHP settings for all of my domains.
This parameter settings can be updated in the "Performance and security settings" group, or can also be changed in the Additional configuration directives (which takes precedence over the former).

With the following query I can get the configuration of this parameter (in table PhpSettingsParameters) and of additional parameters (table PhpSettingsCustom), but only from what's defined for the subscription. If the settings are updated on the domain I can't find them.
SQL:
select
d.name, psp.id, psc.value custom_value, psp.value param_value
from
domains d, Subscriptions s
LEFT JOIN SubscriptionProperties sp ON (s.id=sp.subscription_id and sp.name='phpSettingsId')
LEFT JOIN PhpSettingsCustom psc ON (psc.id = sp.value and psc.`value` like 'disable_functions=%')
LEFT JOIN PhpSettingsParameters psp ON (psp.id=sp.value AND psp.`name` = 'disable_functions')
where
d.status = 0 AND
d.id=s.object_id and s.Object_type='domain'

Does anyone knows how to get this configuration, no matter where it was defined?

Thak you in advance.
 
Have you tried to use command:

# plesk bin subscription_settings --show-php-settings domain.tld | grep disable_functions

?
 
I haven't. That kind of works, but I want to know the configuration for all the domains.
Isn't there a way to do it in DB query?
 
Try something like this:
Code:
 #  for domain in $(plesk bin site -l); do plesk bin subscription_settings --show-php-settings $domain | grep disable_functions; done
 
I haven't. That kind of works, but I want to know the configuration for all the domains.
Isn't there a way to do it in DB query?
disable_function value can be found in PhpSettingsParameters table. But unfortunately, there is no direct relevance with domain or subscription ID in that table.
So the id there is just a unique number to match one setting from another.
So PhpSettingsParameters.id = PhpSettings.id; in PhpSettings there is a colum "noteId". PhpSettings.noteId = Notes.id.
And from "Notes" there is a reference to "Templates": Notes.id = Templates.note_id.
And only from there you can associate with "PlansSubscriptions" or "Clients" tables where you can fetch subscriptions or domains.
 
disable_function value can be found in PhpSettingsParameters table. But unfortunately, there is no direct relevance with domain or subscription ID in that table.
So the id there is just a unique number to match one setting from another.
So PhpSettingsParameters.id = PhpSettings.id; in PhpSettings there is a colum "noteId". PhpSettings.noteId = Notes.id.
And from "Notes" there is a reference to "Templates": Notes.id = Templates.note_id.
And only from there you can associate with "PlansSubscriptions" or "Clients" tables where you can fetch subscriptions or domains.
It does not work, as all PhpSettings.noteId are set to 0, and Notes table is empty.
 
Try something like this:
Code:
 #  for domain in $(plesk bin site -l); do plesk bin subscription_settings --show-php-settings $domain | grep disable_functions; done
That's a good way for it, if I don't find a better one. Actually I just need for the active domains, but that I can figure out.
The bigger problem is that's slow, but I only need to do checks once in a while.
 
Back
Top