Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have this strange and stupid problem I'm trying to resolve for a couple of hours now. I have installed apache 2.2.10 (it was compiled from source a long time ago), and PHP-5.3.6. Both are working just great except for the fact I can't get PHP to load the php.ini file.

This is my config.nice file:

'./configure' \
'--prefix=/usr/local/php-5.3.6' \
'--with-config-file-path=/usr/local/php-5.3.6/lib' \
'--with-apxs2=/usr/local/apache-2.2.10/bin/apxs' \
'--with-curl' \
'--with-mysql' \
'--with-zlib' \
'--with-bz2' \
'--with-gd' \
'--with-jpeg-dir' \
'--with-png-dir' \
'--enable-mbstring' \
'--with-freetype-dir' \
'--with-t1lib' \
'--enable-gd-native-ttf' \
'--enable-gd-jis-conv' \
'--with-openssl' \
'--with-openssl-dir' \
'--enable-pcntl' \
"$@"

I've used this config.nice for all the PHP versions since 5.2 with slight changes and it is working this way on a couple of servers. It's probably something small I'm missing and I can't figure what it is.

I set the '--with-config-file-path' because I though php can't find it's own path or something. In the defined path I have a file called php.ini which is copied from the PHP 5.3.6 tarball (php.ini-development).

The file should be working as it's the original but I can't see because it's not loading - phpinfo() returns:

Configuration File (php.ini) Path:  
/usr/local/php-5.3.6/lib
Loaded Configuration File:  
(none) 

Does anybody have an idea what may be the problem ?

Relevant info:
@Server OS: Slackware 12.2
@Apache Version: 2.2.10
@Apache User / Group: daemon / daemon
@PHP Version: 5.3.6 (Latest)
@PHP ini file: /usr/local/php-5.3.6/lib/php.ini
@PHP ini file perms: 777 (daemon.daemon)

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

I'm guessing the file isn't actually there or there is a permissions problem. I'd run echo "<?php phpinfo() ?>" | strace php 2>&1 | grep php.ini to see what is happening.

share|improve this answer
    
The file is there 100% :) This is what I get when I entered your command - pastebin.com/X2XX9GiW –  tftd May 5 '11 at 18:38
    
"Loaded Configuration File => /usr/local/php-5.3.6/lib/php.ini" It worked that time. How are you calling php when it doesn't work? –  Mark Wagner May 5 '11 at 18:59
    
Hmm... That's really strange. I'm calling it from a apache server (from my browser actually) –  tftd May 5 '11 at 19:26
    
It is a permission problem. Apache usually doesn't run as root. That user needs to be able to read php.ini. You could make the perms 644 on it. –  Mark Wagner May 5 '11 at 20:05
    
I figured it out. There was a "PHPINIDir" set in apache's virtual hosts. That was forcing apache to tell PHP "Use the php.ini in X dir" and there wasn't any php.ini there. Thanks for the help :) –  tftd May 5 '11 at 20:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.