0

I am using Wordpress and Woocommerce, I am using PHP Sessions to Display Post ID in Email Notification, Sessions work fine with Free Product, But When Product is paid/premium and got purchased with any Payment Method Option like PayPal, PayTM, PayUMoney, InstaMojo etc, Sessions work only for 10-15 mins and automatically got stop working, It's weird but I don't know why this happening.

One more thing I wanna mention when session stop working and I do any change in woocommerce code from Cpanel or Wordpress Admin Panel Like Enable/Disable Tax Option, Sessions Automatically start working again for next few minutes.

Page 1

    <?php session_start();
    $wp_session = WP_Session::get_instance();
    $wp_session['regnumber'] = $post->ID;  ?>

Page2

        session_start();
        echo $wp_session['regnumber'];

Also Tried with $_SESSION

I want this session to work every time, or is there any alternate option available ?

Any Help will be appreciatable...

Sanad Qazi
  • 77
  • 7
  • You're going to have to be a little bit more specific than "_automatically got stop working_" – GrumpyCrouton Mar 27 '19 at 19:59
  • Thanks for comment, I Explained the whole problem. @GrumpyCrouton – Sanad Qazi Mar 27 '19 at 20:01
  • No you didn't, you just said it "doesn't work", what do you mean by "doesn't work"? What _does_ it do? – GrumpyCrouton Mar 27 '19 at 20:04
  • When Product is paid/premium and got purchased with any Payment Method Option like PayPal, PayTM, PayUMoney, InstaMojo etc, Sessions work only for 10-15 mins and automatically got stop working, It's weird but I don't know why this happening. **doesn't work means Doesn't Print Anything** – Sanad Qazi Mar 27 '19 at 20:05
  • 1
    That doesn't sound like an issue with sessions, it sounds like a 500 Internal Server Error, which means you need to enable error reporting in your server/website so you can see what the error is. We cannot help you with the little amount of information we have about your issue. – GrumpyCrouton Mar 27 '19 at 20:09
  • May be website issue, but not server, because I also tried this with Azure Servers and got same results. – Sanad Qazi Mar 27 '19 at 20:19
  • Of course you got the same result, because it's an internal server error. Meaning it's the websites server side code (PHP) that is throwing an exception, which also stops execution of the code (hence; no output) – GrumpyCrouton Mar 27 '19 at 20:20
  • can you suggest me, how to enable error reporting for this issue, it should be from wordpress side or php, Can you suggest me what should I do now ? I am using Linux shared server with Cpanel – Sanad Qazi Mar 27 '19 at 20:25
  • https://stackoverflow.com/questions/1053424/how-do-i-get-php-errors-to-display – GrumpyCrouton Mar 27 '19 at 20:26
  • Please increase the session timeout . Check the site for reference : https://pc021.info/change-session-expire-time-in-wordpress/ – PHP Web Mar 27 '19 at 20:41

0 Answers0