php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26735 php.ini not read
Submitted: 2003-12-28 19:06 UTC Modified: 2004-01-07 21:12 UTC
From: cmouse at youzen dot projectb2 dot net Assigned:
Status: Not a bug Package: PHP options/info functions
PHP Version: 4.3.4 OS: Linux 2.4.23
Private report: No CVE-ID: None
 [2003-12-28 19:06 UTC] cmouse at youzen dot projectb2 dot net
Description:
------------
php.ini appears not to be read properly by php. I've tried changing values on the file stated by phpinfo() to be the one to read. Unfortunately after restart of apache, no changes reflect. F.ex. I have upload_tmp_dir set to a path, but phpinfo() claims that it's not set. 


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-12-28 19:07 UTC] gschlossnagle@php.net
Can you confirm that the file you are editing is the one 
that PHP is using (according to the php.ini line in 
phpinfo()).
 [2003-12-28 19:08 UTC] gschlossnagle@php.net
Can you confirm that the file you are editing is the one 
that PHP is using (according to the php.ini line in 
phpinfo()).
 [2003-12-28 19:10 UTC] cmouse at youzen dot projectb2 dot net
yes, I can confirm it
 [2003-12-28 19:12 UTC] gschlossnagle@php.net
Can you post your phpinfo() and your php.ini?
 [2003-12-28 19:15 UTC] cmouse at youzen dot projectb2 dot net
I'll paste the thing I'm trying to modify:

### php.ini ###
; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
upload_tmp_dir = /www/tmp

### phpinfo() ###
upload_tmp_dir no value no value
 [2003-12-28 19:40 UTC] gschlossnagle@php.net
Works fine for me:

19:49:41(george@shanti)[~/src/php-4.3.4]> ./sapi/cli/php -r 
'phpinfo();' | grep php.ini
Configuration File (php.ini) Path => /usr/local/lib/php.ini

19:49:48(george@shanti)[~/src/php-4.3.4]> cat /usr/local/
lib/php.iniupload_tmp_dir = /www/tmp

19:49:57(george@shanti)[~/src/php-4.3.4]> ./sapi/cli/php -r 
'phpinfo();' | grep upload_tmp_dir
upload_tmp_dir => /www/tmp => /www/tmp

Again, 10-1 your php.ini is not what you expect it is.  
Please repeat the above steps on your system,  If you are 
running this as mod_php, make steps 1 and 3 be clips from 
the html dump.


 [2003-12-28 19:45 UTC] cmouse at youzen dot projectb2 dot net
Ok.
Here goes:

php -r 'phpinfo();' | grep php.ini
Configuration File (php.ini) Path => /etc/php/php.ini

cat /etc/php/php.ini | grep upload_tmp_dir
upload_tmp_dir = "/www/tmp"

php -r 'phpinfo();' | grep upload_tmp_dir
upload_tmp_dir => no value => no value
 [2003-12-28 19:48 UTC] cmouse at youzen dot projectb2 dot net
Ah and here are mod_php clips:
Configuration File (php.ini) Path  /etc/php/php.ini

cat /etc/php/php.ini | grep upload_tmp_dir
upload_tmp_dir = "/www/tmp"

upload_tmp_dir no value no value
 [2003-12-28 22:39 UTC] gschlossnagle@php.net
what does this (with correct path substiitution) return 
you:

strace -eopen ./sapi/cli/php -r '' 2>&1 | grep ini

 [2003-12-29 08:20 UTC] cmouse at youzen dot projectb2 dot net
The problem was that PHP tells me it is using /etc/php/php.ini as FILE, when this is PATH. Suprise suprise, it tries to read /etc/php/php.ini/php.ini, which is not what I expected. A more clearer configure item would be nice (and output of phpinfo()):

The strace readout:
$ strace -eopen php -r '' 2>&1 | grep ini
open("php/php-cli.ini", O_RDONLY)       = -1 ENOENT (No such file or directory)
open("/etc/php/php.ini/php-cli.ini", O_RDONLY) = -1 ENOTDIR (Not a directory)
open("php/php.ini", O_RDONLY)           = -1 ENOENT (No such file or directory)
open("/etc/php/php.ini/php.ini", O_RDONLY) = -1 ENOTDIR (Not a directory)
 [2003-12-29 20:18 UTC] gschlossnagle@php.net
That strace doesn't indicate that any of the files were 
found.  Those locations are typical for many vendor 
distributed php's are you sure that the php you are running 
is the one you installed and not the vendor-distributed 
one?

 [2004-01-07 04:04 UTC] cmouse at youzen dot projectb2 dot net
The 'files' are directories. No vendor-specific php would use /etc/php/php.ini/php.ini... The "problem" is simply that when I configured php with ./configure the unclear configure help text fooled me.
 [2004-01-07 21:12 UTC] sniper@php.net
User error -> not bug.

 [2004-03-04 22:10 UTC] ahmed at googgun dot com
ran into the same problem :) ... the documentation (specifically ./configure --help) is unclear, as well phpinfo() is unclear as it labels the value supplied with --with-config-file-path as Configuration File (php.ini) Path, and typically Path of a file would include the filename. Request that the flag be renamed --with-config-file-dir and the corrosponding phpinfo() label be changed as well... i suspect that labels is trivial compared to making the programs obey the labels.

Cheers.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 09 06:01:32 2024 UTC