4

I've built from source php + php-fpm + nginx few times.

I'm used to keep everything inside /usr/local

Hovewer php-fpm config file php-fpm.conf is always loaded from /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.

Is there any way to do this?

Does the default location depends upon a directive set when running ./config before the actual build?

Paolo
  • 15,233
  • 27
  • 70
  • 91

3 Answers3

4

Performing a multi-file search on PHP's sources and build files reveals that

php-fpm.conf location is determined by the compile-time option

--sysconfdir=/path/to

specified when invoking ./configure

halfer
  • 19,824
  • 17
  • 99
  • 186
Paolo
  • 15,233
  • 27
  • 70
  • 91
  • How can I check where the php-fpm is searching for the .conf file at runtime? I'm not seeing it in `php -i`. – timetofly Dec 01 '16 at 20:53
  • 1
    @Blossoming_Flower You should see the directive path option after `Configure Command =>` when you invoke `php -i`. If it's not there it should be in the default location. Post your comment as a question (and write here a commend you did that) so I can give you a more detailed answer (and others may contribute). – Paolo Dec 02 '16 at 12:08
0

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~

:p

touchstone
  • 1,055
  • 1
  • 10
  • 14
-1
  • 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 line

    SetEnv PHPRC /location/todir/containing/phpinifile

  • To specify a custom php.ini with NginX check this link

  • As you pointed out you can use a CLI directive to choose a different php.ini as well

Community
  • 1
  • 1
Simone Conti
  • 306
  • 4
  • 9
  • 4
    `--with-config-file-path=PATH` sets the location of `php.ini`, not the location of `php-fpm.conf` – Paolo Feb 27 '16 at 13:34