I have a php session value like this,

$_SESSION['variable'] = "value";

How to access this session value in Joomla admin?

This session value is stored in PHP file and not in Joomla front end (php file created within public_html).

I thought the question is not clear may be, Simply set session in php using $_SESSION and get in joomla using either $_SESSION or getSession() method.

Joomla files and php files are in the same public_html, other than there is no common for these 2 files.

Can anyone please help me.

1 Answer 1


Firstly, make sure you are setting this variable using the Joomla API rather than the PHP native session handler. This will ensure the session value, along with all other Joomla session value are stored in the same place.

You can set the session variable like so:

$session = JFactory::getSession();
$session->set('variable', 'value');

and easily access it like so:

$session = JFactory::getSession();
  • Thanks for your response. But session variable stored from php class file not from joomla. If I add this code in my php file it is not working.
    – Kowsalya
    Commented Apr 9, 2018 at 10:33
  • 1
    In which case you need to call the Joomla framework on your custom PHP file before being able to use the methods
    – Lodder
    Commented Apr 9, 2018 at 11:05
  • A input given by user, I want to get these details by using session. (By using file and database it is working)
    – Kowsalya
    Commented Apr 9, 2018 at 11:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.