Solved Strange php-fpm behavior with reading the .user.ini

castris

Verified User
Joined
Apr 16, 2021
Messages
96
Location
Arcenillas
I know it: I'm new to DirectAdmin, but something is leaving me out of place.

A client asks me to keep the .user.ini working for him.

It seems somewhat strange to me because by default .user.ini is configured in PHP when there is a php-fpm installation.

Even so, I consulted PHP-FPM and saw that this behavior was expected.

Even so, I confirm that the phi of the client version, 8.2, is fine, `/usr/local/php82/lib/php.ini` in addition to adding it explicitly.

PHP:
cat /usr/local/php82/lib/php.ini | grep user.ini
user_ini.filename = ".user.ini"
;user_ini.filename =
;user_ini.cache_ttl = 300

I also verify it in a file with phpinfo(), to do a double check

But after restarting php82-fpm and waiting even 300 seconds, nothing. Nothing has changed. No value was applied and more particularly the session.save_path which was what we were expecting.

Code:
.user.ini
is in path of site,
Code:
/home/inigocalderon/domains/MYDOMAIN.com/private_html

I don't want to use global modifications or do it via dashboard, because in the end the user (it is a nanaged reseller type private server) ended up destroying everything.

Apreciate help about the problem.
 

Attachments

  • CastrisPHP 8.2.21 - phpinfo()0715083657.jpg
    CastrisPHP 8.2.21 - phpinfo()0715083657.jpg
    26.9 KB · Views: 96
  • Castrisroot@kvm487 ~0715083729.jpg
    Castrisroot@kvm487 ~0715083729.jpg
    31.4 KB · Views: 42
  • CastrisPHP 8.2.21 - phpinfo()0715083813.jpg
    CastrisPHP 8.2.21 - phpinfo()0715083813.jpg
    14.2 KB · Views: 40
session.save_path

is hard config in php-fpm.conf process. It inside "Custom HTTPD Configurations".
 
you might need to disable config session savepath for that users by adding this to customize php-fpm on the user.
Code:
|?PHP_SESSION_SAVE_PATH=""|
 
> I don't want to use global modifications or do it via dashboard, because in the end the user (it is a managed reseller type private server) ended up destroying everything.

In the post I indicate that I do not want to use global modifications but rather the use of .user.ini which is recognized in the manuals.[PEr-path php settings, controllable by The User](https://docs.directadmin.com/ webservices/php/php-fpm.html#per-path-php-settings-controllable-by-the-user)

Thanks.
 
Yeah, I know. I just show you there have some "php_admin_value" prevent .user.ini rewrite config.

so you need to customize to remove some "php_admin_value" config.
 
A lot of thanks for the explanation.

Curious, but it still doesn't get into my head.

In any case, I did the job.

In php-fpm Global custom1 I added:
Code:
|?PHP_SESSION_SAVE_PATH=""|

This modified the ./data/users/USER/php/php-fpm82.conf

PHP:
php_admin_value[session.save_path] = ""

But the behavior of .user.ini was still not applied and upon reviewing the info.php

I see that now the session.save_path is simply without value, which is not the point of the matter.

Code:
session.save_path no value no value

I still think that using .user.ini should override the configuration if it exists in the user's php-fpm.conf, since it is a `per-directory` configuration

Appreciate your help.
 
php_admin_value[session.save_path]

Must completely remove from the config/files.

Some logics if/else of template have something wrong.
try this
Code:
|?PHP_SESSION_SAVE_PATH=|
 
"This is the way"

I put this on php-fpm 8.2 |CUSTOM1| and now work fine .user.ini

A lot of thanks. 🙏
 
Odd... I don't have the .user.ini enabled in the php.ini (like it's default) and still can use a .user.ini in my public_html and it works too, without any path adjustment requirements. And it works.
 
Back
Top