• Resolved javdude

    (@javdude)


    I have a WP page that calls a script with following lines in it …

    session_start();
    $_SESSION[‘myKey’] = “Some data I need later”;
    header(‘Location:http://wp.achieve-it.co.uk/test-php’);

    As you can see another page called test-php is called on the last line which contains only the following lines …

    <?php
    print “before”;
    print “myKey is set: “.$_SESSION[‘myKey’];
    print “after”;
    ?>

    The out put is ..

    beforemyKey is set: after

    Which means the plugin has NOT worked.

    Can you help explain why this simple test of the plugin does not work?
    Have I misunderstood what the plugin is about?

    Many Thanks in advance.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Daniel Bachhuber

    (@danielbachhuber)

    Hi @javdude:

    Which means the plugin has NOT worked.

    Your assessment is correct, in fact.

    Can you help explain why this simple test of the plugin does not work?
    Have I misunderstood what the plugin is about?

    The test you’ve provided doesn’t work as expected because your test.php script doesn’t load WordPress (and the plugin).

    Your WordPress page has loaded WordPress (and the plugin), which means WP Native PHP Sessions is properly configured.

    Your test.php script is executed directly, without loading WordPress, which means WP Native PHP Sessions isn’t loaded, and doesn’t handle your script’s interactions with PHP sessions.

    When the WP Native PHP Sessions plugin is loaded, it registers a series of PHP callbacks to handle interactions with the PHP sessions API. Loading the plugin is a necessary step to offload sessions to the database.

    Thread Starter javdude

    (@javdude)

    Hi Daniel,

    Thank you for your reply, much appreciated.

    I am not a professional WP developer and would be grateful if you could give me a couple of steps to follow to get around this problem.

    Many thanks for you help on this.

    Javid.

    Plugin Contributor Daniel Bachhuber

    (@danielbachhuber)

    Thank you for your reply, much appreciated.

    You’re welcome!

    I am not a professional WP developer and would be grateful if you could give me a couple of steps to follow to get around this problem.

    I’m sorry, but the scope of support offered through this forum is limited to the usage of WP Native PHP Sessions, not general WordPress development questions.

    Thread Starter javdude

    (@javdude)

    I understand. Thanks for all your help.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Usage or misunderstood ?’ is closed to new replies.