473,320 Members | 1,965 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Difference between get_cfg_var() and ini_get()

Hi,

I am writing a PHP library which uses some new configuration options in
php.ini. To read the values in my code, I have the choice between
get_cfg_var() and ini_get(). From the doc, I thought that they were
working almost the same way, except that get_cfg_var() gets its value
from the ini file, and ini_get() gives the current value, different if
ini_set was called.

Actually, when I have this line in php.ini :

Autoload.preload_include_path = On

I get this :

get_cfg_var('Autoload.preload_include_path') = string(1) "1" => OK

ini_get('Autoload.preload_include_path') = string(0) "" => Strange
From the doc again, it means that ini_get() fails.


So, my questions are :

- does ini_get() support only PHP predefined configuration options (or
configuration options defined by an extension) ?
- If it is not the case, why doesn't it read my option ?

Thanks in advance

François

Mar 10 '06 #1
2 4315
fl*******@yahoo.fr wrote:
Hi,

I am writing a PHP library which uses some new configuration options in
php.ini. To read the values in my code, I have the choice between
get_cfg_var() and ini_get(). From the doc, I thought that they were
working almost the same way, except that get_cfg_var() gets its value
from the ini file, and ini_get() gives the current value, different if
ini_set was called.

Actually, when I have this line in php.ini :

Autoload.preload_include_path = On

I get this :

get_cfg_var('Autoload.preload_include_path') = string(1) "1" => OK

ini_get('Autoload.preload_include_path') = string(0) "" => Strange
From the doc again, it means that ini_get() fails.


So, my questions are :

- does ini_get() support only PHP predefined configuration options (or
configuration options defined by an extension) ?
- If it is not the case, why doesn't it read my option ?

Thanks in advance

François


The difference between get_cfg_var() and ini_get() is that the former
returns whatever is in php.ini while the latter returns the runtime
settings. Say you stick the following into php.ini:

[tomkat]
tomcruise.secret = "He's gay!"

get_cfg_var() will happily return the text while ini_get() would not,
as it's not configurable option belonging to any extension. Or, in
another word, ini_get() will only return items that are defined in the
source code.

Mar 10 '06 #2
OK. Thank you for confirming this point.

Mar 13 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

34
by: yensao | last post by:
Hi, I have a hard time to understand difference and similarities between Relational database model and the Object-Oriented model. Can somebody help me with this? Thank you in advance. ...
21
by: b83503104 | last post by:
Hi, Can someone tell me the difference between single quote and double quote? Thanks
4
by: jamesyreid | last post by:
Hi, I'm really sorry to post this as I know it must have been asked countless times before, but I can't find an answer anywhere. Does anyone have a snippet of JavaScript code I could borrow...
3
by: bbawa1 | last post by:
Hi, I have a table which has a field ItemsReceived of type datetime. I have a grid view which has two columns. In first column i have to show the data from field ItemsReceived and in second...
12
by: Petronius | last post by:
Hallo, does anyone have an idea how to implement difference lists in Javascript? Thanks allot in advance
3
by: bjlinwu | last post by:
echo get_cfg_var("register_globals"); Why it doesn't output anything?
5
by: Julius | last post by:
Hej dudes, I need to calc the difference between two timestamps / dates ... For example what i need to calculate: Date 1: 2007.11.06 - 20:13:04 Date 2: 2007.11.07 - 21:13:04 Difference:...
9
by: viki1967 | last post by:
Hi all! This new forum its great! :) Congratulations !!! My answer: why this my code not working? Nothing error but not work the difference.... : <html>
11
by: cmb3587 | last post by:
I have two arrays and I'm trying to create a 3rd array that is the difference between the two arrays Ex: arrayA: 3 5 8 9 arrayB: 3 4 6 9 difference of A-B: 5 8 however, my...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.