Hi everyone, I'm having a problem moving my code to a linux computer.I won't post the whole code here, but an accurate example that reproduces exactly the error.
//************************ 1.php <?php session_register('tree'); $_SESSION['tree'] = "This is tree number one"; header("Location: 2.php"); ?> //************************ 2.php <?php print_r($_SESSION, false); ?> //************************ php.ini (incomplete) session.save_handler = files session.save_path = /tmp/php/sessions/ o ;C:/temp/php/sessions for Windows session.use_cookies = 1 session.name = cito session.auto_start = 1 session.cookie_lifetime = 0 session.cookie_path = / session.cookie_domain = session.cookie_httponly = session.serialize_handler = php session.gc_probability = 1 session.gc_divisor = 100 session.gc_maxlifetime = 1440 session.bug_compat_42 = 0 session.bug_compat_warn = 0 session.referer_check = session.entropy_length = 0 session.entropy_file = session.cache_limiter = nocache session.cache_expire = 180 session.use_trans_sid = 0 session.hash_function = 0 session.hash_bits_per_character = 4 url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset=" The web server is Apache 2.2 with php 5.24 for both, Linux & Windows.In Linux the Apache server is run by the 'apache' user, which has reading, writing and execution grants on /tmp/php/sessions/
The output for 2.php is: Array ( [tree] => This is tree number one ) is what I get on Windows, but on Linux I get:Notice: Undefined variable: _SESSION in /var/www/html/2.php on line 2
I don't know what the error is, but something evident is that on Linux session.auto_start = 1 is NOT working properly. On Windows it is not necessary to explicitly start the session to use the $_SESSION, so no need to session_start(). If on Linux I add session_start() at the top of each script, the script executes well.
I want to know why session.auto_start does not work on Linux. If you require the whole php.ini, I'll send it gladly
<<attachment: smime.p7s>>