session.save path

From PmaWiki
Jump to: navigation, search

Like many other PHP applications phpMyAdmin tries to save user related data in a folder on the web server which should be defined in the loaded php.ini (or in httpd.conf or .htaccess if you are using the Apache web server).

If you get:

"phpMyAdmin - Error 
Cannot start session without errors, please check errors 
given in your PHP and/or webserver log file
and configure your PHP installation properly." 

or if you get redirected to the login page in pma prior to v. 3.1.2 (due to error detection not working) first find out why PHP fails to create a session file. You can find your current settings for 'session.save_path' in the output of phpinfo(); (see below) or by running the following test-script:

<?php
// save as "session_test.php" inside your webspace  
ini_set('display_errors', 'On');
error_reporting(6143);

session_start();

$sessionSavePath = ini_get('session.save_path');

echo '<br><div style="background:#def;padding:6px">'
   , 'If a session could be started successfully <b>you should'
   , ' not see any Warning(s)</b>, otherwise check the path/folder'
   , ' mentioned in the warning(s) for proper access rights.<hr>';
   
if (empty($sessionSavePath)) {
    echo 'A "<b>session.save_path</b>" is currently',
         ' <b>not</b> set.<br>Normally "<b>';
    if (isset($_ENV['TMP'])) {
        echo  $_ENV['TMP'], '</b>" ($_ENV["TMP"]) ';
    } else {
        echo '/tmp</b>" or "<b>C:\tmp</b>" (or whatever',
             ' the OS default "TMP" folder is set to)';
    }    
    echo ' is used in this case.';
} else {
    echo 'The current "session.save_path" is "<b>',
         $sessionSavePath, '</b>".';
}

echo '<br>Session file name: "<b>sess_', session_id()
   , '</b>".</div><br>';
?>

Either this folder doesn't exist (create one!) or the user php/apache runs under has no file create/delete rights (check the properties). If you are using centos and get "...Server localhost (tcp 11211) failed with: Connection refused (111)..." the memcache service must be started.

If you want to change the setting your php.ini to, e.g., "C:\Windows\temp" or "/tmp" you have to find the location of your php.ini:

<?php
 // save as, e.g., "info.php" inside your webspace  
 phpinfo(); 
?>

Search the output of this script for "Loaded Configuration File" (recent PHP versions only). If such information is not present the php.ini from "Configuration File (php.ini) Path" might be used (but could also be defined in the start parameters of the web server).

Note: session.cookie_secure must be 'Off' if you are not using a secure connection ("https").

Personal tools