Php/php-fpm can’t find php.ini

php-fpmphp.iniphp56

I'm having an issue where php and php-fpm can't find php.ini. I installed 5.6.13 from source. The question

PHP doesn't load php.ini

is very similar but the solutions there haven't helped me.

The config.nice is as follows

#! /bin/sh
#
# Created by configure

'./configure' \
'--prefix=/usr/local' \
'--localstatedir=/var' \
'--sysconfdir=/etc/php-fpm' \
'--with-config-file-path=/etc/php-fpm' \
'--enable-fpm' \
'--with-mysql=mysqlnd' \
'--with-mysqli=mysqlnd' \
'--enable-cli' \
'--with-zlib' \
'--with-openssl' \
'--with-libdir=lib64' \
'--with-gd' \
'--enable-session' \
'--enable-soap' \
'--with-freetype-dir' \
'--enable-gd-native-ttf' \
'--with-ldap' \
'--with-pdo-mysql=mysqlnd' \
'--enable-zip' \
'--with-mcrypt=/usr/local' \
'--enable-mbstring' \
'--with-curl' \
'--enable-intl' \
'--with-xsl' \
'--with-tidy' \
'--enable-pcntl' \
"$@"

I've used this config.nice on two other servers with the same version of PHP. All servers are RHAT 5.11. All have nginx.

If I run

echo "<?php phpinfo() ?>" | strace php-fpm  2>&1 | grep php.ini

I get:

open("/usr/local/sbin/php.ini", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/php.ini", O_RDONLY) = -1 ENOENT (No such file or directory)

if I run

php -i | grep php.ini 

I get:

Configuration File (php.ini) Path => /etc/php-fpm 
Loaded Configuration File => (none)

If I run:

php --ini

I get:

Configuration File (php.ini) Path: /usr/local/lib
Loaded Configuration File:         (none)
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)

Creating a symlink will allow PHP to find the php.ini in /etc/php-fpm and I can use -c too, but that doesn't explain why it doesn't pick it up by default and isn't consistent with my other servers behavior.

Anyone ever experience anything similar?

Best Answer

I tried doing a new install without make clean or make clean all and that did not work.

I ended up running make clean and make clean all and redoing the whole installation again and that did it!