Reputation: 9011
I am trying to read some settings from php.ini using zend. The API that I am using is
long zend_ini_long(char *name, uint name_length, int orig)
But it always returns 0. I have double checked the name and also made sure that the value I am specifying in php.ini is greater then 0. Is there anything I am missing?
Upvotes: 3
Views: 952
Reputation: 4987
long maxwait = zend_ini_long("max_execution_time",
sizeof("max_execution_time"), 0);
The problem is that ZEND_STRL is not returning the right length for the way that this API is intended to be used, so don't use it.
I should add that most of the hash tables maintained internally by PHP assume that the NUL terminator character is included in the length of the string being hashed (its part of the overall binary safety concept), which is why we use sizeof() rather than strlen() or sizeof()-1.
Upvotes: 3
Reputation: 6840
You can use the standard php function: ini_get('var-name');
Example:
ini_get('include_path');
Upvotes: 0