Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

PHP Session Problem

Featured Replies

Hi, can any of you help me with this problem?

 

I have recently moved to Linux hosting, but develop locally using WAMP.

I'm having trouble trying to replicate session behaviour on my host - namely the session cookie appears to be empty when I leave one page and move to the next. For example - I set the session variable thus:

 

session_start;
$user_input='blah';
$_SESSION['data']=$user_input;

 

and then on the next page I use the following:

 

session_start;
if ($_SESSION['data']=='blah'){
$x=$_SESSION['data'];
echo "$x";}
else
{
echo "errors";
}

 

This is actually a much simpler description of what I'm doing - but in essence it's the same.

When I test this locally I get the expected result - in this example the text 'blah' in the browser. However, when I test on the host, I get the error message.

I did a print_r() of the $_SESSION variable on each location, and locally it reads out the content of the variable, but on the host the variable is empty once it is picked up by the recieving page.

 

I've contacted my host, but they suggested that this might be down to the dev environment, specifically the variable 'path' on account of my local setup being windows, and the host being Linux. I checked the settings with phpinfo() on both environments, and under the session section there are the following differences:

 

session.bug_compat_42: Host = On Local = Off

session.gc_divisor: Host = 100 Local = 1000

session.hash_bits_per_character: Host = 4 Local = 5

session.save_path: Host = No value Local = C:/Program Files/wamp/tmp

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.