Ok so
session_save_path() should use a path and not a url i.e. session_save_start('admin/tmp');
It should not be coded in any way that will make the code difficult to move i.e. like yours
When I test this code
<?php
session_save_path('http://testing.localhost/session/tmp/');
$ok = session_start();
?>
<!doctype html>
<html >
<head>
<meta charset="UTF-8">
<title>Test</title>
</head>
<body>
<?php
echo $ok ? 'session OK' : 'session FAILED';
?>
</body>
</html>
'testing.localhost' is a valid Virtual Host domain on my system and the subfolder 'session/tmp' exists.
You should check that whatever folder you use actually exists or this will not workI get these errors in my 'php error log'
[04-Mar-2015 15:57:36 Europe/London] PHP Warning: session_start() [<a href='function.session-start'>function.session-start</a>]: open(http://testing.localhost/session/tmp/\sess_rs8fb9ag93gq6h6e2g52a01or6, O_RDWR) failed: Invalid argument (22) in D:\websrc\www\testing\test.php on line 4
[04-Mar-2015 15:57:36 Europe/London] PHP Stack trace:
[04-Mar-2015 15:57:36 Europe/London] PHP 1. {main}() D:\websrc\www\testing\test.php:0
[04-Mar-2015 15:57:36 Europe/London] PHP 2. session_start() D:\websrc\www\testing\test.php:4
[04-Mar-2015 15:57:36 Europe/London] PHP Warning: Unknown: open(http://testing.localhost/session/tmp/\sess_rs8fb9ag93gq6h6e2g52a01or6, O_RDWR) failed: Invalid argument (22) in Unknown on line 0
[04-Mar-2015 15:57:36 Europe/London] PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (http://testing.localhost/session/tmp/) in Unknown on line 0
[04-Mar-2015 15:57:37 Europe/London] PHP Warning: session_start() [<a href='function.session-start'>function.session-start</a>]: open(http://testing.localhost/session/tmp/\sess_rs8fb9ag93gq6h6e2g52a01or6, O_RDWR) failed: Invalid argument (22) in D:\websrc\www\testing\test.php on line 4
[04-Mar-2015 15:57:37 Europe/London] PHP Stack trace:
[04-Mar-2015 15:57:37 Europe/London] PHP 1. {main}() D:\websrc\www\testing\test.php:0
[04-Mar-2015 15:57:37 Europe/London] PHP 2. session_start() D:\websrc\www\testing\test.php:4
[04-Mar-2015 15:57:37 Europe/London] PHP Warning: Unknown: open(http://testing.localhost/session/tmp/\sess_rs8fb9ag93gq6h6e2g52a01or6, O_RDWR) failed: Invalid argument (22) in Unknown on line 0
[04-Mar-2015 15:57:37 Europe/London] PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (http://testing.localhost/session/tmp/) in Unknown on line 0
So I would bet that if you looked on your LIVE system you would be getting them there as well. If not I would bet that the previous coders have turned OFF error_reporting in some way in order to hide there mistakes.
If I code it like this
<?php
session_save_path('session/tmp/');
$ok = session_start();
?>
<!doctype html>
<html >
<head>
<meta charset="UTF-8">
<title>Test</title>
</head>
<body>
<?php
echo $ok ? 'session OK' : 'session FAILED';
?>
</body>
</html>
It works perfectly and session files are created in the 'session/tmp/' folder.
I guess the first thing you can do on this system is correct this error.
Also I would make sure that you have these setting in your php.ini
display_errors = On
log_errors = On
error_log = "c:/wamp/logs/php_error.log"
Of course you may find that the system has so many errors that you have to turn this option Off
display_errors = Off
Then the errors will only get written to the "c:/wamp/logs/php_error.log" and not the browser.
And you should take regular looks at the "c:/wamp/logs/php_error.log"
So you can see all the other errors generated by this system.
Also remember that every script that wants to use this OTHER session store has to set the session_save_path() before doing a start_session() Otherwise it will be looking for its session files in the wrong place.
session_save_path('session/tmp/');
start_session()
---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>Read The Manuals Apache --
MySQL --
PHP --
phpMyAdminGet your Apache/MySQL/mariaDB/PHP ADDONs here from the
WAMPServer alternate Repo-X-X-X-
Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-
Edited 2 time(s). Last edit at 03/04/2015 05:14PM by RiggsFolly.