title: In Joomla 3.4 JFactory::getApplication('site'); stopped working
body: <p>I've used below code from this reference : <a href="https://stackoverflow.com/a/2288181/4819200">https://stackoverflow.com/a/2288181/4819200</a></p>
  
  <pre><code>&lt;?php
  //http://domain.com/script/script.php?username=username&amp;passwd=password
  
  define( '_JEXEC', 1 );
  define('JPATH_BASE', '../' );
  define( 'DS', DIRECTORY_SEPARATOR );
  require_once('../configuration.php');
  require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
  require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
  require_once ( JPATH_BASE .DS.'libraries'.DS.'joomla'.DS.'factory.php' );
  
  /* Create the Application */
  $mainframe =&amp; JFactory::getApplication('site');
  jimport('joomla.plugin.helper');
  
  $credentials = array();
  $credentials['username'] = JRequest::getVar('username', '', 'method', 'username');
  $credentials['password'] = JRequest::getVar('passwd', '', 'method', 'passwd');
  
  //perform the login action
  $error = $mainframe-&gt;login($credentials);
  $user = JFactory::getUser();
  //now you are logged in
  
  $mainframe-&gt;logout();
  //now you are logged out
  </code></pre>
  
  <blockquote>
    <p>Now, the Issue</p>
  </blockquote>
  
  <p>It was working in Joomla 2.3 version and it stopped working in 3.4 version.
  Now, it is not returning from line <strong><em>$mainframe =&amp; JFactory::getApplication('site');</em></strong>.</p>
  
  <p>You can suggest me code for latest version.</p>
  
  <p><strong><em>Note :</em></strong> I'm not joomla guy. But, I've worked on some PHP frameworks.</p>