php phpMyAdmin 中没有错误就无法启动会话

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5013118/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 16:32:13  来源:igfitidea点击:

Cannot start session without errors in phpMyAdmin

phpsessionphpmyadmin

提问by rciiipo

I get the below error when pointing browser to phpMyAdmin

将浏览器指向 phpMyAdmin 时出现以下错误

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

无法在没有错误的情况下启动会话,请检查您的 PHP 和/或网络服务器日志文件中给出的错误并正确配置您的 PHP 安装。

I have checked everything and can't seem to figure out what the problem is.

我已经检查了所有内容,但似乎无法弄清楚问题是什么。

In my php.ini file I have:

在我的 php.ini 文件中,我有:

session.save_path = "/var/lib/php/session"

Permissions:

权限:

drwxr-xr-x  2 root apache 4096 Feb 16 04:47 session

Nothing seems to work. Even changing permission on session directory to 777.

似乎没有任何效果。甚至将会话目录的权限更改为 777。

回答by random

Problem usually lies on your browser end.

问题通常出在您的浏览器端。

You need to flush your browser cache, delete the cookies for the server/host and then retry loading phpMyAdmin.

您需要刷新浏览器缓存,删除服务器/主机的 cookie,然后重试加载 phpMyAdmin。

If you want to go all out, clear out the session folder on the server as well.

如果您想全力以赴,请清除服务器上的会话文件夹。

One possible reason for this is a session data mismatchbetween the browser and the webserver causing it to not be able to pull out the required session info and dumping this error dialogue on your lap.

一个可能的原因是浏览器和网络服务器之间的会话数据不匹配,导致它无法提取所需的会话信息并将此错误对话转储到您的膝盖上。

回答by Bradley Flood

The problem can be due to file and folder permissions; You can try changing the folder permissions:

问题可能是由于文件和文件夹权限;您可以尝试更改文件夹权限:

sudo chmod 777 /var/lib/php/session/

This will set full read/write permissions on the PHP sessions folder.

这将设置对 PHP 会话文件夹的完全读/写权限。

Note: the php/session/folder may be in a different location on some servers. Check your php.inifor your session path.

注意:该php/session/文件夹在某些服务器上可能位于不同的位置。检查您php.ini的会话路径。

回答by Dave F

In my case it was the wrong ownership for /var/lib/php/session. I changed that to the Apache user and group (the user and group that the webserver runs as) and all was well.

就我而言,这是错误的所有权/var/lib/php/session。我将其更改为 Apache 用户和组(网络服务器运行的用户和组),一切正常。

回答by ba1ar

Set the session.save_pathin your php.ini. Make sure that you are using an existing directory.

设置session.save_path在你的php.ini。确保您使用的是现有目录。

If still you found any issue then give write & execution permission to that folder for the user by which you are going to use that folder.[This is specially used in case of IIS]

如果您仍然发现任何问题,则为您将要使用该文件夹的用户授予对该文件夹的写入和执行权限。[这是专门用于 IIS 的情况]

回答by Kevin Sadler

There appears to be two common causes for this error, one is to do with the server configuration and the session.save_path and the other is the browser cache.

此错误似乎有两个常见原因,一个是与服务器配置和 session.save_path 相关,另一个是浏览器缓存。

If you encounter this error try using a different browser or machine before you attempt to alter your Apache and PHP configurations on the server!

如果您遇到此错误,请在尝试更改服务器上的 Apache 和 PHP 配置之前尝试使用不同的浏览器或机器!

Note that clearing the Cookies for the server is not enough, you need to clear the cache.

注意清除服务器的Cookies是不够的,还需要清除缓存。

In Firefox clearing all history and cookies is easy, but you may not want to get rid of everything. Clearing the cache is hidden away in Firefox:

在 Firefox 中清除所有历史记录和 cookie 很容易,但您可能不想清除所有内容。清除缓存隐藏在 Firefox 中:

Tools > Options > Advanced > Network: Cached Web Content - Clear Now

工具 > 选项 > 高级 > 网络:缓存的 Web 内容 - 立即清除

回答by Mir-Ismaili

STOP 777!

停止777



If you use nginx (like me), just change the ownership of the folders under /var/lib/php/from apacheto nginx:

如果您使用 nginx(像我一样),只需将文件夹的所有权/var/lib/php/从 fromapache更改为nginx

[root@centos ~]# cd /var/lib/php/
[root@centos php]# ll
total 12
drwxrwx---. 2 root apache 4096 Jan 30 16:23 opcache
drwxrwx---. 2 root apache 4096 Feb  5 20:56 session
drwxrwx---. 2 root apache 4096 Jan 30 16:23 wsdlcache

[root@centos php]# chown -R :nginx opcache/
[root@centos php]# chown -R :nginx session/
[root@centos php]# chown -R :nginx wsdlcache/
[root@centos php]# ll
total 12
drwxrwx---. 2 root nginx 4096 Jan 30 16:23 opcache
drwxrwx---. 2 root nginx 4096 Feb  5 20:56 session
drwxrwx---. 2 root nginx 4096 Jan 30 16:23 wsdlcache

And also for the folders under /var/lib/phpMyAdmin/:

还有以下文件夹/var/lib/phpMyAdmin/

[root@centos php]# cd /var/lib/phpMyAdmin
[root@centos phpMyAdmin]# ll
total 12
drwxr-x---. 2 apache apache 4096 Dec 23 20:29 config
drwxr-x---. 2 apache apache 4096 Dec 23 20:29 save
drwxr-x---. 2 apache apache 4096 Dec 23 20:29 upload

[root@centos phpMyAdmin]# chown -R nginx:nginx config/
[root@centos phpMyAdmin]# chown -R nginx:nginx save/
[root@centos phpMyAdmin]# chown -R nginx:nginx upload/
[root@centos phpMyAdmin]# ll
total 12
drwxr-x---. 2 nginx nginx 4096 Dec 23 20:29 config
drwxr-x---. 2 nginx nginx 4096 Dec 23 20:29 save
drwxr-x---. 2 nginx nginx 4096 Dec 23 20:29 upload

回答by Amadu Bah

Login fails if session folder in not writeable. To check that, create a PHP file in your web directory with:

如果会话文件夹不可写,则登录失败。要检查这一点,请在您的 Web 目录中创建一个 PHP 文件:

<?php
$sessionPath = 'undefined';

if (!($sessionPath = ini_get('session.save_path'))) {
    $sessionPath = isset($_ENV['TMP']) ? $_ENV['TMP'] : sys_get_temp_dir();
}

if (!is_writeable($sessionPath)) {
    echo 'Session directory "'. $sessionPath . '"" is not writeable';
} else {
    echo 'Session directory: "' . $sessionPath . '" is writeable';
}

If session folder is not writeable do either

如果会话文件夹不可写,请执行以下任一操作

sudo setfacl -R -m u:www-data:rwx <session directory>or chmod 777 <session directory>-

sudo setfacl -R -m u:www-data:rwx <session directory>chmod 777 <session directory>-

回答by miguel

Ok,

好的,

I'm using windows 7 ultimate and WAMP 2.4 server The tmp folder was missing, so I created one and this solved my problem. Check the php.ini file for the correct path: session.save_path

我正在使用 Windows 7 Ultimate 和 WAMP 2.4 服务器 tmp 文件夹丢失,所以我创建了一个,这解决了我的问题。检查 php.ini 文件的正确路径:session.save_path

回答by Simom Hasan

For Xampp, Deleting temp flies from the 'root' folder works for me.

对于 Xampp,从“根”文件夹中删除临时文件对我有用。

TH

回答by Sugoi Reed

This is sometimes due to an invalid session key. If using XAMPP, what worked for me was opening the temp folder in XAMPP xampp/temp then deleting the session files starting with sess_

这有时是由于无效的会话密钥。如果使用 XAMPP,对我有用的是在 XAMPP xampp/temp 中打开临时文件夹,然后删除以 sess_ 开头的会话文件