php 设置php-fpm默认配置文件位置
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35668008/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Set php-fpm default configuration file location
提问by Paolo
I've built from source php + php-fpm + nginx few times.
我已经从源 php + php-fpm + nginx 构建了几次。
I'm used to keep everything inside /usr/local
我习惯把一切都藏在里面 /usr/local
Hovewer php-fpm config file php-fpm.conf
is always loaded from /etc/
然而,php-fpm 配置文件php-fpm.conf
总是从/etc/
Of course I can change the location with the -y
directive when php-fpm is started but I'd prefer to have a different location by default.
当然,我可以-y
在 php-fpm 启动时使用指令更改位置,但默认情况下我更喜欢使用不同的位置。
Is there any way to do this?
有没有办法做到这一点?
Does the default location depends upon a directive set when running ./config
before the actual build?
默认位置是否取决于在./config
实际构建之前运行时设置的指令?
采纳答案by Paolo
Performing a multi-file search on PHP's sources and build files reveals that
对 PHP 的源代码和构建文件执行多文件搜索显示
php-fpm.conf
location is determined by the compile-time option
php-fpm.conf
位置由编译时选项决定
--sysconfdir=/path/to
specified when invoking ./configure
调用时指定 ./configure
回答by touchstone
actually the real reason is you used the old TARed php source code,
you should RM the old TARed php source one and re-Tar xvf php-version.tar.gz,
lastly, configure it and so on. you can try it if you don't believe it~
其实真正的原因是你使用了旧的TARed php源代码,
你应该RM旧的TARed php源代码一并重新Tar xvf php-version.tar.gz,
最后,配置它等等。不信可以试试~
:p
:p
回答by Simone Conti
You can compile php with the
--with-config-file-path=PATH
compile-time option.For your reference PHP Compile-Time Options
You can use a custom php.ini file using a
.htaccess
with Apache adding le lineSetEnv PHPRC /location/todir/containing/phpinifile
As you pointed out you can use a CLI directive to choose a different
php.ini
as well
您可以使用
--with-config-file-path=PATH
compile-time 选项编译 php 。供您参考PHP 编译时选项
您可以使用
.htaccess
带有 Apache 添加 le 行的自定义 php.ini 文件SetEnv PHPRC /location/todir/containing/phpinifile
正如你指出,你可以使用CLI指令来选择不同
php.ini
,以及