phpMyAdmin 中无法正常启动会话

发布于 2024-10-17 18:09:01 字数 380 浏览 4 评论 0原文

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

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

我已经检查了所有内容,但似乎无法找出问题所在。

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

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

权限:

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

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

I get the below error when pointing browser to phpMyAdmin

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

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

In my php.ini file I have:

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(20

离鸿 2024-10-24 18:09:02

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

TH

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

TH

深海不蓝 2024-10-24 18:09:02

我清除了浏览器缓存。创建了 phpinfo.php 中列出的会话文件夹。

成功了!

I cleared browser cache. Created session folder as listed in phpinfo.php.

It worked !

贪恋 2024-10-24 18:09:02

知道该线程被标记为已解决后,它就会尽早出现在 Google 搜索中针对给定术语的搜索中。因此,我认为提及可能导致此错误的另一个原因可能会有用。

如果您启用了“安全/安全 cookies”,则必须为 phpMyAdmin 禁用它,因为它们在激活后将无法工作。因此,请确保您

Header set Set-Cookie HttpOnly;Secure

的配置中没有类似以下内容:

Knowing this thread is marked as solved, it shows up early on Google Search for the given term. So I thought it might be useful to mention another reason that can lead to this error.

If you enabled "safe/secure cookies", that has to be disabled for phpMyAdmin as it wont work with them being activated. So make sure you have nothing like:

Header set Set-Cookie HttpOnly;Secure

in your config.

茶色山野 2024-10-24 18:09:02

问题还可能是 php.ini 中的 session.save_handler 值错误。当我将其更改为 memcached 时出现此错误,并在更改回 files 时再次出现此错误

The problem can also be that you have a wrong session.save_handler value in your php.ini. I got this error when I changed it to memcached, and worked again when changing back to files

⒈起吃苦の倖褔 2024-10-24 18:09:02

我在 Windows Server 2016 中发现的问题是 PHP 使用的临时目录的权限错误。我添加了 IUSR。

Problem I found in Windows server 2016 was that the permissions were wrong on the temp directory used by PHP. I added IUSR.

羁客 2024-10-24 18:09:02

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

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_

旧人 2024-10-24 18:09:02

我最近遇到了同样的问题。
通过截断 php 存储会话数据的临时目录解决了这个问题。

即对于 Unix 操作系统:
OP 参考号文件(此临时目录因您的操作系统而异)

find /var/lib/php/session -type f -delete

在截断该目录后,我可以毫无问题地启动 phpmyadmin。
如果更改所有权和/或权限失败,我希望这可以帮助其他遇到同样问题的人。

I recently had this very same problem.
It was resolved by truncating the temp directory where php stores its session data.

ie for a Unix OS:
OP ref. file (this temp directory will differ for your OS)

find /var/lib/php/session -type f -delete

After truncating the directory I was able to start phpmyadmin without issue.
I hope this helps others with the same problem if changing ownership and/or permissions fail.

世界等同你 2024-10-24 18:09:02

如果您检查浏览器并且没有问题,请在服务器端检查这些命令:

根据 php.ini 文件中的 session.save_path,检查是否存在会话目录
(默认路径是:“/var/lib/php/session”
因此,如果路径不存在,请创建它。
现在可能需要更改目录的所有权,例如(更改:基于您的系统的用户:组)

sudo chown user:group /var/lib/php/session

然后授予会话路径权限:

sudo chmod 0777 /var/lib/php/session

现在刷新您的浏览器

if you checked your browser and doesn't problem so check these commands on the server side :

based on session.save_path in php.ini file, check is exists session directory
(default path is : "/var/lib/php/session")
so if path isn't exists, make it.
now may need to either change ownership of the directory, e.g (change: user:group based your system)

sudo chown user:group /var/lib/php/session

then give permission to session path:

sudo chmod 0777 /var/lib/php/session

now refresh your browser

去了角落 2024-10-24 18:09:02

对于 Ubuntu

在我的例子中,错误指出问题出在哪里。
所以我只是运行这段代码,它就被修复了。

sudo chmod 777 /opt/lampp/temp

在此处输入图像描述

For Ubuntu:

In my case the error specify where is the issue.
So I just run this code and it is fixed.

sudo chmod 777 /opt/lampp/temp

enter image description here

玻璃人 2024-10-24 18:09:01

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

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

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

一个可能的原因是

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.

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 mismatch between 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.

清晰传感 2024-10-24 18:09:01

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

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

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

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

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.

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

思念绕指尖 2024-10-24 18:09:01

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

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.

暮倦 2024-10-24 18:09:01

停止777


如果您使用 nginx(像我一样),只需将 /var/lib/php/ 下的文件夹的所有权从 apache 更改为 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

以及 /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

STOP 777!


If you use nginx (like me), just change the ownership of the folders under /var/lib/php/ from apache to 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/:

[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
小耗子 2024-10-24 18:09:01

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

如果您仍然发现任何问题,请写信&您要使用该文件夹的用户对该文件夹的执行权限。[这特别用于 IIS]

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

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]

無心 2024-10-24 18:09:01

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

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

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

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

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

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.

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!

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

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:

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

_失温 2024-10-24 18:09:01

好的,

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

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

忘羡 2024-10-24 18:09:01

如果会话文件夹不可写,则登录失败。要检查这一点,请在您的 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';
}

如果会话文件夹不可写,请执行

sudo setfacl -R -mu:www-data:rwxchmod 777 <会话目录>
-

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

<?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>
-

蒲公英的约定 2024-10-24 18:09:01

第一:如果不是session目录(在我的例子中是)

sudo mkdir /var/lib/php/session

第二:session目录设置权限

sudo chmod 777 /var/lib/php/session

First: if not session dir (in my case it was)

sudo mkdir /var/lib/php/session

Second: set privilege for session dir

sudo chmod 777 /var/lib/php/session
甜柠檬 2024-10-24 18:09:01

就我而言,问题是由于磁盘空间不足造成的。我想向像我这样的其他用户提及这一点:)

In my case, problem was due to low disk space. I want to mention it for other users like me :)

木格 2024-10-24 18:09:01

我花了一整天的时间来解决同样的问题。我的答案是简单地清除浏览器的缓存。太糟糕了,我已经重新安装了 webserver/phpmyadmin 3 次了。 :(

I worked on this same problem for a full day. The answer for me was to simply clear my browser's cache. Too bad, I had already reinstalled the webserver/phpmyadmin 3 times. :(

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文