This one drove me nuts.
I was compiling various versions of PHP4 on Mac OS X and even though the phpinfo() was saying that it was loading the php.ini at /usr/local/php/php.ini it really wasnt (still haven’t figured out what it was loading).
But after trawling about for a while, I found this excellent forum post that told me how to get my compiled PHP to load the right php.ini
The solution?
compile PHP with these flags
–sysconfdir=/etc –with-config-file-path=/etc –with-config-file-scan-dir=/etc/php.d
substituting the correct folder paths for each of the flags