1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

$_SESSION variable from site not being passed to WordPress

Discussion in 'PHP' started by rfeio, Jun 26, 2009.

  1. #1
    Hi,

    I have installed WP to be part of my existing website.

    I now have the need to pass $_SESSION variables to WP from the site, but for some reason I'm being unable to accomplish this.


    Some more info:

    - I have Register Globals turned off

    - I've put session_start() on wp-config.php

    still, the $_SESSION variables don't work... Sad



    Here's a strange thing; locally when I specify in index.php:

    session_start();
    echo "value= ".$_SESSION['test'];

    Everything works fine and I can pass values from the site's scripts into WP.

    When doing exactly the same thing on a real server, it doesn't work. The $_SESSION values seem to be killed?


    Please, help!
     
    rfeio, Jun 26, 2009 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    Remove it from wp-config.

    You would most likely need to put it at the beginning of index.php, or in wp-blog-header.php.

    Also, this could break plugins so test to make sure all of your site still works after implementing it.
     
    jestep, Jun 26, 2009 IP
    Bohra likes this.
  3. rfeio

    rfeio Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I've tried removing from wp-config.php and putting it on the index.php file. The result was the same. :-(
     
    rfeio, Jun 26, 2009 IP
  4. wd_2k6

    wd_2k6 Peon

    Messages:
    1,740
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    0
    #4
    wd_2k6, Jun 26, 2009 IP
  5. NatalicWolf

    NatalicWolf Peon

    Messages:
    262
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Ok, this is a bit difficult to fix if you are not familiar with PHP. Either WP or your other script, is using a different session name...if you would like, i can help you figure it out over messenger. Simply message me.
     
    NatalicWolf, Jun 26, 2009 IP
  6. rfeio

    rfeio Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I appreciate everybody's help on this matter!

    For future reference; I've managed to solve this problem and I've posted the solution in my blog at:

    http://www.ruifeio.com/2009/06/30/php-session-not-being-from-site-to-wordpress/
     
    rfeio, Jun 30, 2009 IP