PHP CLI and FPM

Kurogane

Verified User
Joined
Oct 6, 2019
Messages
86
I am having problems about the PHP INI configuration.

Currently it is using parameters in the FPM-POOL configuration.

To give an example, it has been configured to `memory_limit` overwrite the systemwide configuration which it does without problem.

What is the problem? when I try to run a script via CLI it does not use the FPM-POOL configuration if not the global PHP INI configuration.

How can I do to run a script via CLI respecting the FPM-POOL configuration?
 
Not working

I setup Per-path settings and setup memory_limit.

When i run /usr/local/php82/bin/php -i | grep memory_limit in the user. Always give me default PHP INI setting and not the one i set.
 
OK, I see. I was wrong, it won't work for PHP cli.

Currently, [PATH=] and [HOST=] sections only work under CGI/FastCGI.

See:

Code:
; Directives following the section heading [PATH=/www/mysite] only
; apply to PHP files in the /www/mysite directory.  Directives
; following the section heading [HOST=www.example.com] only apply to
; PHP files served from www.example.com.  Directives set in these
; special sections cannot be overridden by user-defined INI files or
; at runtime. Currently, [PATH=] and [HOST=] sections only work under
; CGI/FastCGI.
; http://php.net/ini.sections

Why do you need more RAM in a specific directory?
 
Not sure if understand correctly.

I want to use path settings because i think whatever php script run there overridden the setting.

For the other, is just an example and easy to detect if the configuration was working or not.
 
I want to use path settings because i think whatever php script run there overridden the setting.

It turns out the PATH= does not work for PHP scripts in CLI. My question was on why do you need it? If you clarify your case, probably I could offer another solution.

Without knowing details I could offer to only start your scripts with:

Code:
#!/usr/local/bin/php -nc/home/username/php.ini

or with any other PHP path from your setup.
 
Impossible to make process CLI reading config from the fpm-pool.

just do simple thing.
Code:
php -d memory_limit=1G ./script.php
 
It turns out the PATH= does not work for PHP scripts in CLI. My question was on why do you need it? If you clarify your case, probably I could offer another solution.

Because i say i use FPM-POOL.

In directadmin when you overriden the setting this going to php.conf and use php_admin_value and because is se there i wouldn't worry about the configurations.

I just want in user when use CLI not use global PHP INI if not use the setting of FPM-POOL or whatever it does not conflict with other configurations and use custom configuration.

Impossible to make process CLI reading config from the fpm-pool.

just do simple thing.
Code:
php -d memory_limit=1G ./script.php

Yes, I read this from so much searching before you posted and I see that a definite or temporary way, at least I want what I am looking for.
 
Back
Top