• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

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