Search code examples
sessiondokuwikiphp

How can I read session variables at dokuwikis main.php created outside the dokuwiki pages?


I do create a session variables at a php file containing an index 'fullName'. If I try to access the variable from the dokuwikis main.php an 'Index not found error' appears and no values are saved in that session. Leaving the dokuwiki and going back to the original php file I can access the varaibale again. Can someone explain why that happens and how to work around?

Running a phpinfo() I do get back the same path values for session_save_path. Thanks for your help!

EDIT:

Heres some code:


host.tld/anypage.php:

<?PHP
    session_start();
    $_SESSION['fullName'] = "any string";
?>

host.tld/dokuwiki eg. /usr/share/dokuwiki/lib/tpl/dokuwiki/main.php:

<html>   
    <?PHP
        session_start();
    ?>
    ....
    <body>
        <?PHP
            echo $_SESSION['fullName']; // Index error, no session variables at all
            //
        ?>
        //Dokuwiki content
    </body>
</html>

Solution

  • DokuWiki's session name is 'dokuwiki'. You either need to change your session name in your external application or in DokuWiki. For the latter have a look at inc/init.php