You are not logged in.
Hello community,
Is it possible to create separate php.ini files for php (cli) and php-fpm, like it is possible on debian and ubuntu with two folders /etc/php/7.0/cli and /etc/php/7.0/fpm?
I will be also cool if I can load independent modules with a conf.d directory for each subsystem.
I also tried to use the structure like it is configured in ubuntu 16.04 without any success.
And the solution to pass the php executable the -c option seems very awkward to me.
Has anyone an idea how can I configure it separately?
Best regards, Fiete.
Last edited by fieteboerner (2016-10-07 21:08:10)
Offline
--php-ini path|file
-c path|file Look for php.ini file in the directory path or use the specified file
...
FILES
php-cli.ini The configuration file for the CLI version of PHP.
mod note: moved to N.C.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
thanks @Trilby,
is there also a way to load separate module configurations with a different conf.d directory, that allows me to enable different modules dynamically for each php subsystem?
Offline
That doesn't make any sense. Anything in conf.d can be put in the php.ini file. The conf.d directory is specifically for settings that should be applied to all php instances regardless of where they are running - so this is definitely not what you want.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I know this directory structure from debian and ubuntu that's the reason why I am trying to configure it likely.
There is a conf.d folder in every directory like:
/etc/php/7.0
├── cli
| ├── php.ini
│ └── conf.d
├── fpm
| ├── php.ini
│ ├── conf.d
│ └── pool.d
└── mods-availableall links in the conf.d directories are pointing to an ini-file in mods-available. Thats allows me to enable/disable modules without editing any ini-file only with linking to mods-available folder.
Thats the only reason why I am asking.
If it is not possible with arch linux, so I have to deal with it and do it in the more complex way by editing each php.ini file manually. ![]()
Thanks anyway.
Offline
It could be possible. But you'd have to create all those folders and all the files in the mods-available folder anyways.
But also note the very small segment of man page I already quoted. You gave give a path to scan for ini files. This would do exactly what you want, provided you had some modules-available directory populated with something.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
But I cannot load different mods, because php (cli) and php-fpm are only looking in /etc/php/conf.d to load additional mods. And as long as the php executables does not look in different directories I cannot make any difference between them. Unfortunately I cannot set a config-file-scan-dir option in a php.ini file.
Or do I have missed or missunderstood something?
If not and it is only possible by recompiling the php executables with diffrent config parameters you can close this post. (I don't see any link or button to do this)
Thanks
Offline
I have found something in the php documentation. The PHP_INI_SCAN_DIR env var overrides phps --with-config-file-scan-dir config option.
Therefore I have moved my /usr/lib/systemd/system/php-fpm.service to /etc/systemd/system/php-fpm.service and add the following configuration to the service file.
[Unit]
Description=The PHP FastCGI Process Manager
After=syslog.target network.target
[Service]
Type=notify
Environment="PHP_INI_SCAN_DIR=/etc/php/fpm/conf.d" ; I have added this line
PIDFile=/run/php-fpm/php-fpm.pid
ExecStart=/usr/bin/php-fpm --nodaemonize --fpm-config /etc/php/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
[Install]
WantedBy=multi-user.targetAfter restarting/reloading the services, php-fpm loads only the files from /etc/php/fpm/conf.d and no longer from /etc/php/conf.d. This allows me to configure cli and fpm separately. ![]()
Offline
thanks @fieteboerner!
i moved xdebug.ini to a new dir:
/etc/php7/php-fpm/conf.d/
in my case, the file i edited was:
## file: /usr/lib/systemd/system/php-fpm7.service
Environment="PHP_INI_SCAN_DIR=/etc/php7/php-fpm/conf.d" ; << I have added this line
then did:
> systemctl daemon-reload
and after, reloaded php-fpm
Offline