Jump to content

PHP Directives (Local and Master Values)


iwato

Recommended Posts

QUESTION ONE: What does it mean when no value is set for a configuration option in a PHP extension? Does it mean that the property has not been initialized, that I cannot change it, or something else altogether?QUESTION TWO: What is the difference between Local and Master Values? Do these reflect changes imposed by my operating environment upon installation?NOTE: This is follow-up to the justsomeguy's comment under the topic heading: The ini_set Function. EXAMPLE: The following code was taken from a read-out of the configuration for my system's mbstring extension. It was obtained by calling the phpinfo( ) function.

Directive										Local Value	   Master Valuembstring.detect_order					 no value		   no valuembstring.encoding_translation		  Off				  Offmbstring.func_overload					0						0mbstring.http_input						 pass				passmbstring.http_output					   pass				passmbstring.internal_encoding			  no value		   no valuembstring.language						   neutral				neutralmbstring.strict_detection				  Off				  Offmbstring.substitute_character		   no value		  no value

I apologize for the above formatting, but I do not know how to set columns for this bulletin board.Roddy

Link to comment
Share on other sites

I'm guessing the "master" value is the one set up in the configuration, whereas the local value is the one that is currently in effect. For example, if you've used ini_set() before calling phpinfo(), you'll change the master value, and the new setting will be shown in the local value column.If a value was not set, it means the extension will behave with whatever its compile time (i.e. default) setting is, and that ini_get() would return NULL if you try to get this option's value.

Link to comment
Share on other sites

For example, if you've used ini_set() before calling phpinfo(), you'll change the master value, and the new setting will be shown in the local value column.
That's correct, but may be confusing how you said it. The master values never change, the master values are read from php.ini. The local values are what are actually being used by PHP, they start with the master values but they can be changed by any of the methods listed in the manual (ini_set, local php.ini, .htaccess, etc).
Link to comment
Share on other sites

That's correct, but may be confusing how you said it. The master values never change, the master values are read from php.ini. The local values are what are actually being used by PHP, they start with the master values but they can be changed by any of the methods listed in the manual (ini_set, local php.ini, .htaccess, etc).
This was very helpful. Thank you.Now, what does the value "no value" mean.When I call the ini_get() function for anything evaluated as "no value" nothing is displayed.How am I to treat this response? Does it mean 0, "", or null?Please see my new entry to the topic "Missing Values" before responding.Roddy
Link to comment
Share on other sites

It basically just means the value is undefined, the ini file does not have an entry for that option. What that means to the actual extension varies in how the option gets interpreted. As boen suggested, they probably use a default value for options that are not defined.

Link to comment
Share on other sites

Try to var_dump() this to find out yourself.
Yeah, whenever in doubt, "Dump!"I am getting the idea.Roddy
Link to comment
Share on other sites

  • 7 months later...

your topic here is very similar to my own desire for information. I am designing a website on a hosted server and don't have access to the php.ini file directly. I've had the site running just fine with normal protocols, but when the SSL protocol is activated with https:// the session variables stop working preventing secure access to the site that was previous to the SSL working just fine. I use the phpinfo() function to find out that the environment variable session.cookie_secure was set to off. Seems to me that this variable needs to be set to on if session variables are going to work and your thread here seems to be the only one talking about the ini_set() and ini_get() functions and W3C tutoriols don't list those functions that I can find. My questions are:1. Are these the functions I need in my scripts to both set and retrieve environment variables such as session.cookie_secure?2. Is changing the session.cookie_secure environment variable going to solve the problem of session variables not working with SSL?3. What is the syntax for using the ini_set() and ini_get() variables? Is it like ini_set(variable, value)?

Link to comment
Share on other sites

You can use this function to set the session cookie properties:http://www.php.net/manual/en/function.sess...okie-params.phpMake sure you do that before using session_start.

2. Is changing the session.cookie_secure environment variable going to solve the problem of session variables not working with SSL?
There's only one way to find out.
3. What is the syntax for using the ini_set() and ini_get() variables? Is it like ini_set(variable, value)?
Check the manual:http://www.php.net/manual/en/function.ini-get.phphttp://www.php.net/manual/en/function.ini-set.php
Link to comment
Share on other sites

You can use this function to set the session cookie properties:http://www.php.net/manual/en/function.sess...okie-params.phpMake sure you do that before using session_start.There's only one way to find out.Check the manual:http://www.php.net/manual/en/function.ini-get.phphttp://www.php.net/manual/en/function.ini-set.php
Well that didn't solve the problem of session variables not working with a secure SSL connection.my code is as:<?php function start_session($c) { session_set_cookie_params(0, '/', '.example.com'); session_start(); }?>starting my sessions in this matter did not change the fact that the sessions are NOT working with SSL https: secure connections and in fact caused additional errors in my normal http: connections where before at least my http: connections were working correctly. I am just about to give up on using https at all if I can't find a solution to this problem. This was the error I got when I tried to start my sessions with the above code on my site:Warning: session_start() [function.session-start]: open(/tmp/sess_e7537443665e6cc05d728a566b5c209c, O_RDWR) failed: Permission denied (13) in /home/example/public_html/example.php on line 5and later at the end of the same page I get the following 2 errors:Warning: Unknown: open(/tmp/sess_e7537443665e6cc05d728a566b5c209c, O_RDWR) failed: Permission denied (13) in Unknown on line 0Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0These errors aren't present as long as i'm not using SSL connection for https:. The only time they surface is in secure https: connections.
Link to comment
Share on other sites

Those errors are the reason why sessions aren't working, that means that the process that PHP is running under does not have write permission to the tmp directory where it is saving session files. That might be something to contact your host about. There might be different users that it runs under depending on the protocol.

Link to comment
Share on other sites

Those errors are the reason why sessions aren't working, that means that the process that PHP is running under does not have write permission to the tmp directory where it is saving session files. That might be something to contact your host about. There might be different users that it runs under depending on the protocol.
Thats what I thought, and I tried to tell them it was a configuration problem and not my scripts which worked just fine under normal http: protocol but only started giving me those errors after they installed SSL module for me. But they swear up and down that it's my scripts that are the problem when my save path hasn't been changed from the default the set to begin with. but I can't get them to understand that. Thanks for confirming my own thoughts on what the cause is.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...