• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • 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.

Resolved Applying cli changes to php.ini

MV-YN-NL

New Pleskian
Hello,

I'm trying to get changes I made to php.ini (in this case/opt/plesk/php/7.2/etc/php.ini) to be applied to the actual subscriptions. When I edit a file (from the cli, like using vim or sed) the default values stay unchanged if I look at the php setting of an (unlocked) Subscription using that php version.

httpd restart doesn't change a thing
nginx restart doesn't change a thing
httpdmng --reconfigure-all doesn't change a thing.

When I go in Plesk to Tools & Setting > PHP Settings > 7.2.12 FastCGI application > php.ini I can see the changes I made. Only when I click OK on that page are the changes actually applied. However, we have multiple PHP versions and quite a bunch of servers, so I don't want to have to do this using the Plesk GUI for every server and php version.
I can easily change all the values in values in all php.ini files on all servers using a script, now I just want to have the changed applied using a command as well.

Any ideas?
 
It's better when you define your custom PHP settings in the service plan. That way, if you change the PHP settings in the service plan, you can simply synchronize the plan with all the attached subscriptions. Have a look here: PHP Management

Also note what's written in the section "Inheriting PHP settings" in the link above, it's important to understand this part.

If you edit the php.ini by hand you will have to re-read the PHP handler configuration in the CLI:
Code:
plesk bin php_handler --reread

This will not update the per-domain php.ini files though.

Also worth reading:
How to customize PHP settings in Plesk
How to change values of PHP directives' globally in Plesk

Hope this helps you a bit
 
Thanks, that command did the trick.

We use one set of PHP directives for all service plans which have PHP. So setting the value there would mean even more editing, as we have multiple PHP service plans as well.
 
This didn't do the trick for me.
Edit: I am running Plesk Obsidian version 18.0.34.

What I want:
I administer multiple Plesk servers using Ansible. I edit the php.ini files (e.g. /opt/plesk/php/7.2/etc/php.ini) through the CLI, as an example I'm changing upload_max_filesize.
After having done that I want to know what command(s) to run to propagate those changes to both the Plesk admin interface so they show up as default in the domains and the service plans and apply them to the affected domains.

What happens:
I have tried among others the following commands:
Bash:
$ plesk bin php_handler --reread
$ plesk sbin httpdmng --reconfigure-all
$ plesk repair web -y
$ plesk repair web -server
$ plesk repair web -php-handlers
$ systemctl restart psa
The only command that seems to propagate the changes is $ plesk repair web -php-handlers. HOWEVER: The changes are not immediate (they only show up after a few seconds and/or refreshes, making it unusable with Ansible), and the changes only show up as the new defaults in the service plan PHP settings and the domain specific PHP settings. They do not apply to the domains, even though the GUI now correctly shows the new value as being the new default.

What does work:
When I change the settings through the web UI (Tools & Settings → PHP Settings → <PHP Version> → php.ini, apply changes and click the "OK" button) it briefly says "Applying global PHP settings to domains..." After which the changes to the php.ini are now the new default in the service plan PHP settings, the domain specific PHP settings and are also live in each affected domain (which I check by refreshing the wp-admin/media-new.php page of a WordPress website, which then reflects the new upload_max_filesize. This is the EXACT behaviour I want, but triggered through the CLI so I can push these changes using Ansible.

My question:
What command(s) do I need to run to apply the changes made in the php.ini files in a way that is compatible with Ansible?
 
Are you using FPM? Restarting FPM should make PHP reread the ini files
That works for applying the changes to the live website, yes! Thank you!

Two questions remain now:
  1. Is there a command that restarts all PHP-FPM services? If not, where can I find the service definitions?
  2. What command reliably and instantly causes the web GUI to display the new default values? plesk repair web -php-handlers doesn't do what I want when run using Ansible (command or shell) even after multiple seconds/refreshes, which does work through a regular SSH session.
 
That works for applying the changes to the live website, yes! Thank you!

Two questions remain now:
  1. Is there a command that restarts all PHP-FPM services? If not, where can I find the service definitions?
  2. What command reliably and instantly causes the web GUI to display the new default values? plesk repair web -php-handlers doesn't do what I want when run using Ansible (command or shell) even after multiple seconds/refreshes, which does work through a regular SSH session.
service plesk-phpXX-fpm restart restarts everything, though reload is generally more than sufficient.

A simple bash script couple be written to loop through available PHP versions and restart them all

2. Not entirely sure what you mean by this. What new default values? What web GUI are you referring to?
 
service plesk-phpXX-fpm restart restarts everything, though reload is generally more than sufficient.

A simple bash script couple be written to loop through available PHP versions and restart them all
Oh well, so be it. Where are the service definitions stored, do you happen to know?

2. Not entirely sure what you mean by this. What new default values? What web GUI are you referring to?
I’m referring to the Plesk admin panel as opposed to the CLI. Restarting the PHP-FPM services after editing the php.ini doesn’t update the PHP configuration pages for domains and service plans. I need them to reflect the new (PHP version specific default) values to prevent confusion.
 
Oh well, so be it. Where are the service definitions stored, do you happen to know?


I’m referring to the Plesk admin panel as opposed to the CLI. Restarting the PHP-FPM services after editing the php.ini doesn’t update the PHP configuration pages for domains and service plans. I need them to reflect the new (PHP version specific default) values to prevent confusion.
Different things. One is the global .ini. Another is per-site/subscription .ini that overrides the Global. To modify the subscription/site, edit the service plan then Sync.
 
Back
Top