Pages: Previous12
Current Page: 2 of 2
Re: php Session Cookie not stored issue in Chrome, Edge and Opera
Posted by: Otomatic (Moderator)
Date: December 14, 2020 07:09PM

Hi,

Attention, Windows is case insensitive but PHP under Windows is case sensitive, for example for variable names, $toto and $toTo are two different variables.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: php Session Cookie not stored issue in Chrome, Edge and Opera
Posted by: gpinpin (---.175.182.111.static.user.ono.com)
Date: December 24, 2020 01:39PM

Bonjour
J'utilise depuis maintenant 5 ans les wamp et versions successives.
Apache 2.4.46a et antérieur. PHP 7.4.13 et MariaDB toutes versions comme par exemple en ce moment la 10.5.8
Les cookies de mes forums ne sont jamais gardés. Je précise seulement le LOCAL
Je n'ai jamais cherché à comprendre. Mais en lisant ce post je me dis que si il n'y a pas de remonté c'est que ce n'est pas important et que depuis longtemps je me suis habitué......
D'ailleurs je ne sais meme pas ou sont stockés ces cookies du local wamp.

Donc comme je suis profane et pas trop spécialiste c'est juste pour conforter que ce problème existe je pense.
C'est en lisant pour le SSL que je suis parvenu à ce post puisque oui il faut lire et relire pour arriver à comprendre correctement.
A+ Gpinpin

Options: ReplyQuote
Re: php Session Cookie not stored issue in Chrome, Edge and Opera
Posted by: Otomatic (Moderator)
Date: December 24, 2020 02:18PM

En Français, c'est dans le forum francophone.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: php Session Cookie not stored issue in Chrome, Edge and Opera
Posted by: Gemsteal (---.12-2.cable.virginm.net)
Date: January 10, 2021 03:59PM

Just leaving an update on this topic

1 - To confirm this issue does not happen on a live hosting server. All browsers allow the setting of the php session cookie, (Safari, Chrome, Edge, Opera and Firefox)

2 - To confirm In Wampserver the default php.ini results in Firefox allowing the php session cookie to be set but Chrome, Edge and Opera block its creation citing the ’same site’ and ‘secure’ issue. Interesting (to me anyway), when I change the php.ini file 'session.cookie_secure' to 1 (also True or On and remove the semicolon) and 'session.cookie_samesite = “None” Firefox sets the cookie with the right attributes but Chrome, Edge and Opera don’t, However If you look in the inspector though the php session cookie is not set it does not report that it is blocking its creation. It may be I need to alter another setting in the php.ini file to allow its creation.

3 - I tried an alternate local server program, Xampp, and this gave the same issues as Wampserver - ie Chrome, Edge , Opera would block the saving of the php session cookie citing the ‘same site’ and secure issue and though I did not test to the same extent altering the php.in file gave the same results as Wampserver. (I did have some issues when I uninstalled Xampp - it played havoc with phpmyadmin login for Wampserver and even though I tried going in to reset the password and user name in the config files I kept getting a ‘Failed to set session cookie. Maybe you are using HTTP instead of HTTPS.’ error and in the end I had to reinstall Wampserver to restore things to normal)

4 - It looks as though its just something about my machine or set up that’s causing the issue smiling smiley. Though things are fine (in a way) if I test using Firefox as a browser I think the new versions of Firefox coming along may lead me to have the same problems sadly. My computer is a MacBook Pro running Big Sur with a windows partition which I use , for various reasons to write my software and test, and I am not sure if that may be the issue, though it shouldn’t be

5 - I will go over to the Mac side of the computer and hook up a local server on that side and see if it gives the same issues. I will update the topic later.

Options: ReplyQuote
Re: php Session Cookie not stored issue in Chrome, Edge and Opera
Posted by: Gemsteal (---.12-2.cable.virginm.net)
Date: January 11, 2021 01:46PM

update

Working on the MAC side of my computer using XAMPP (seems like a few programs still have not caught up with the Big Sur upgrade and don't work yet) as a local server.

Had the same issues as working on the windows side using Wampserver and Xampp. The php session cookie was blocked again by Chrome, Edge, Opera and Safari. It worked OK with Firefox. Chrome, Edge and Opera all specified the issue 'Indicate whether a cookie is intended to be set in a cross-site context by specifying its SameSite attribute' . Safari didn't indicate what the issue was, the php session cookie was just not set without saying why.

I must be doing doing something quite fundamentally wrong smiling smiley

Options: ReplyQuote
Re: php Session Cookie not stored issue in Chrome, Edge and Opera
Posted by: RiggsFolly (Moderator)
Date: January 11, 2021 04:32PM

Hi,

I am wondering how much of this issue may be due to the code that you are using, so can I suggest you place these 2 simple scripts into your DocumentRoot of one of your sites and try them out


Call this sess1.php
<?php
    session_start();
    if ( $_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['sessVal']) {
        $_SESSION['sessVal'] = $_POST['sessVal'];
        // go to another page and view session data
        header('Location: sess2.php');
        exit;
    }
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
</head>
    <body>

        <form action="sess1.php" method="POST">
            <label for="sessId">Enter a value, any value</label>
            <input type="text" name="sessVal" id="seeId">
            <input type="submit" name="submit" value="Press Me">
        </form>

    </body>
</html>

Call this sess2.php

<?php
    session_start();
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
</head>
    <body>

<?php
    echo '<pre>' . print_r($_SESSION,1) . '</pre>';
?>
        <p>We should see the value you entered on the line below</p>
<?php
    if ( isset($_SESSION['sessVal'] ) ) {
        echo "<p> Session is set to >>$_SESSION[sessVal]<<</p>";
    } else {
        echo 'NO SESSION value set';
    }
?>
    </body>
</html>

Then run sess1 simply from the address bar and enter a little text and see if it gets to sess2.php without any of these issues.
Thanks

---------------------------------------------------------------------------------------------
(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 -- phpMyAdmin
Get 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-

Options: ReplyQuote
Re: php Session Cookie not stored issue in Chrome, Edge and Opera
Posted by: Gemsteal (---.12-2.cable.virginm.net)
Date: January 11, 2021 05:58PM

Hi again
Thanks for the code, I'll give it a try but I think i may have found where to look to solve the problem which may interest you.

The common element to every thing was Dreamweaver (apart from the website code). I was previewing the web pages using Wamp (and Xampp) as the testing server and this was giving the issues.

HOWEVER I never thought to check till just now what would happen if I just opened the site by navigating to it in the browser (localhost/XXXXX) - [I was having a look at Visual Code Studio and
trying to work out how to preview the code if I switched over to that]

Website opened and ran with no problems, php session cookie set and saved. Only tried it with Chrome so far but I will post if the issue persists in other browsers.

I think now its an issue within Dreamweaver 2020 somewhere, I think I uninstalled Dreamweaver 2019 and am not quite sure when it updated to 2020. There may be some settings I need to change within Dreamweaver.

I will have a dig around and post an update if I find what I need to do and may try Adobe Dreamweaver support as well.

Options: ReplyQuote
Re: php Session Cookie not stored issue in Chrome, Edge and Opera
Posted by: whit-cooler (5.121.115.---)
Date: January 23, 2021 07:44PM

RiggsFolly Wrote:
-------------------------------------------------------
> Hi
>
> Thanks.
>
> First things is that you should not put
> your code in the \wamp64\www folder. That folder
> contains some useful bits and pieces. You should
> mput your website code either in a subfolder of
> the www folder or some completely other colder on
> disk, and use a Virtual Host to point to it,
> whereever you put it.
>
> See
> [url=http://forum.wampserver.com/read.php?2,127757
> ]The Need for Virtual Hosts[/url]
>
> I have never had issues like this and it strikes
> me it must either be something to do with Mods you
> have made to the php.ini file or something rather
> odd about your windows config. Did you make any
> changes to the php or apache configs at all?
>
> Alternatively it is something that the website you
> are using is doing. Did you write the code for
> this website or is it a downloaded framework or
> CMS like WOrdPress or some other similiar?


thankyou

Options: ReplyQuote
Re: php Session Cookie not stored issue in Chrome, Edge and Opera
Posted by: Gemsteal (---.12-2.cable.virginm.net)
Date: January 25, 2021 11:43AM

Hi

My code is in a sub folder in the www folder and not 'loose' in the www folder.

I think its something to do with the preview function within dreamweaver. If I use a Browser to go direct to the site folder then everything works fine on all browsers using WAMP as the local server (and Xampp). The issue also happens when I try to preview through dreamweaver using Xampp as a local server on both the Windows and MAC side.

In terms of changes, I never tried changing any apache files, only the php.ini file. The issues happened , via the preview option in dreamweaver, with unchanged php.ini files.

To be honest I have stopped looking at the issue and just preview the files direct from the browser on the local host rather than through the dreamweaver preview option. I just need to ween myself of using dreamweaver as a text editor smiling smiley
Dave

Options: ReplyQuote
Pages: Previous12
Current Page: 2 of 2


Sorry, only registered users may post in this forum.