简体   繁体   English

为什么我的 Wordpress 网站设置了 PHPSESSID cookie?

[英]Why does my Wordpress website set a PHPSESSID cookie?

I am currently struggling with the GDPR and all the changes it requires me to apply to my websites.我目前正在努力应对 GDPR 以及它要求我将其应用于我的网站的所有更改。 One of my Wordpress websites, which uses a theme I made myself, sets a cookie named PHPSESSID which stores the session ID - not triggered by any particular action, just when any page of the website is opened.我的一个 Wordpress 网站使用了我自己制作的主题,它设置了一个名为PHPSESSID的 cookie,用于存储会话 ID - 不会由任何特定操作触发,仅在打开网站的任何页面时触发。

The strange thing about it is:它的奇怪之处在于:

1.) I definitely have nothing in my theme code that would do this. 1.) 我的主题代码中绝对没有任何东西可以做到这一点。

2.) I have two identical versions of this website, one for testing on my own webspace and domain, the other on the clients domain and webspace. 2.) 我有这个网站的两个相同版本,一个用于在我自己的网站空间和域上进行测试,另一个用于在客户端域和网站空间上进行测试。 The provider is the same in both cases, so I suppose it's the same server configuration.提供者在这两种情况下都是相同的,所以我想它是相同的服务器配置。 The PHP version is the same (7.2). PHP 版本是相同的 (7.2)。 I have the same theme and plugins in both versions, still the performance site DOES set that cookie, the test site DOES NOT.我在两个版本中都有相同的主题和插件,仍然是性能站点设置了那个 cookie,而测试站点没有。

Now, all I actually want is to get rid of that cookie.现在,我真正想要的是摆脱那个 cookie。 I am not using any other cookies on that site and I don't want to have to put a cookie notice on that site.我没有在该站点上使用任何其他 cookie,也不想在该站点上放置 cookie 通知。

Would anyone have an idea where that cookie could come from and how I could get the server/website to NOT set it?有没有人知道那个 cookie 可能来自哪里以及我如何让服务器/网站不设置它?

This is for session.这是用于会话。 If you are using session by using session_start() at the most top of your script.如果您通过在脚本的最顶部使用 session_start() 来使用会话。 You can find this name (PHPSESSIONID) as an option value in your php.ini following part is from mine (php on IIS)您可以在 php.ini 中找到此名称 (PHPSESSIONID) 作为选项值,以下部分来自我的(IIS 上的 php)

; Name of the session (used as cookie name).
; http://php.net/session.name
session.name = PHPSESSID

I suspect that (without having trying) that you have a cookie because there is an other option set我怀疑(没有尝试)您有一个 cookie,因为还有其他选项集

; Whether to use cookies.
; http://php.net/session.use-cookies
session.use_cookies = 1

you can read more about session and session cookies here http://php.net/manual/en/session.configuration.php#ini.session.use-cookies您可以在此处阅读有关会话和会话 cookie 的更多信息http://php.net/manual/en/session.configuration.php#ini.session.use-cookies

To whoever is interested: I found out that it was due to a plugin.对于感兴趣的人:我发现这是由于插件造成的。 I had two slightly different versions/updates of that one plugin, one setting the PHPSESSID cookie (obviously before any php page is loaded), the other one not.我对那个插件有两个略有不同的版本/更新,一个设置了 PHPSESSID cookie(显然在加载任何 php 页面之前),另一个没有。

Sorry, I should have checked that before (I found out by deactivating all plugins one by one).抱歉,我之前应该检查过的(我是通过一一停用所有插件发现的)。 But my problem is solved now - thanks to everybody who replied!但是我的问题现在已经解决了 - 感谢所有回复的人!

For folks who might come across this, for me I'm pretty sure it was also a plugin: https://wordpress.org/plugins/wp-super-cache/对于可能遇到这个问题的人,对我来说,我很确定它也是一个插件: https : //wordpress.org/plugins/wp-super-cache/

But I don't think it was actually the plugin's fault, per se.但我不认为这实际上是插件本身的错。 Disabling it, then re-enabling it, THEN making sure it's settings enabled caching, seemed to "clear" the HTTP-only cookies.禁用它,然后重新启用它,然后确保它的设置启用缓存,似乎“清除”了仅 HTTP cookie。 Basically I think the plugin was set up to work, but wasn't being used, so old HTTP-only images were being cached - even though I was consistently linking to HTTPS images.基本上我认为该插件已设置为可以工作,但没有被使用,所以旧的仅 HTTP 图像被缓存 - 即使我一直链接到 HTTPS 图像。 Anyway, just in case it might help.无论如何,以防万一它可能会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM