在 Joomla 上出现错误:无法读取会话数据和应用程序实例化错误

Posted

技术标签:

【中文标题】在 Joomla 上出现错误:无法读取会话数据和应用程序实例化错误【英文标题】:Getting Error on Joomla: Failed to Read Session Data and Application Instantiation Error 【发布时间】:2018-08-07 23:44:47 【问题描述】:

我正在尝试在本地主机上运行我的 Joomla 网站,但出现以下错误:

警告:session_start():读取会话数据失败:用户(路径:C:\xampp\tmp)在 C:\xampp\htdocs\Joomla_3\libraries\joomla\session\handler\native.php在第 258 行 显示错误页面时出错:Application Instantiation Error: Failed to start the session

我试图通过 Internet 找到解决方案,并对“configuration.php”文件进行了一些更改,但仍然一次又一次地出现相同的错误: 这是我的配置。文件:

    <?php
class JConfig 
    public $MetaAuthor = '1';
    public $MetaDesc = '';
    public $MetaKeys = '';
    public $MetaRights = '';
    public $MetaTitle = '1';
    public $MetaVersion = '0';
    public $access = '1';
    public $cache_handler = 'file';
    public $cachetime = '15';
    public $caching = '0';
    public $captcha = '0';
    public $cookie_domain = '';
    public $cookie_path = '';
    public $db = 'websitedb';
    public $dbprefix = 'entdc1_';
    public $dbtype = 'mysqli';
    public $debug = '0';
    public $debug_lang = '0';
    public $display_offline_message = '1';
    public $editor = 'tinymce';
    public $error_reporting = 'default';
    public $feed_email = 'none';
    public $feed_limit = '10';
    public $force_ssl = '0';
    public $fromname = 'Wireless-site';
    public $ftp_enable = '1';
    public $ftp_host = '';
    public $ftp_pass = '';
    public $ftp_port = '21';
    public $ftp_root = '';
    public $ftp_user = '';
    public $gzip = '1';
    public $helpurl = 'https://help.joomla.org/proxy/index.php?option=com_help&keyref=Helpmajorminor:keyref';
    public $host = 'localhost';
    public $lifetime = '15';
    public $list_limit = '20';
    public $live_site = '';
    public $log_path = '/xampp/htdocs/Joomla_3/log';
    public $mailer = 'mail';
    public $mailfrom = 'switching-website-feedback@cisco.com';
    public $memcache_compress = '0';
    public $memcache_persist = '1';
    public $memcache_server_host = 'localhost';
    public $memcache_server_port = '11211';
    public $offline = '0';
    public $offline_image = '';
    public $offline_message = 'This site is down for maintenance.<br />Please check back again soon.';
    public $offset = 'UTC';
    public $offset_user = 'UTC';
    public $password = 'admin';
    public $robots = '';
    public $secret = 'HHuagoT8gBoxPG7oyUoXmBD6hnq9oU2P';
    public $sef = '1';
    public $sef_rewrite = '1';
    public $sef_suffix = '0';
    public $sendmail = '/usr/sbin/sendmail';
    public $session_handler = 'database';
    public $sitename = 'Wireless-site';
    public $sitename_pagetitles = '0';
    public $smtpauth = '0';
    public $smtphost = 'localhost';
    public $smtppass = 'Nirvana001';
    public $smtpport = '25';
    public $smtpsecure = 'none';
    public $smtpuser = 'dsrivastava';
    public $tmp_path = '/xampp/htdocs/Joomla_3/tmp';
    public $unicodeslugs = '1';
    public $user = 'admin';
    public $mailonline = '1';
    public $cache_platformprefix = '0';
    public $memcached_persist = '1';
    public $memcached_compress = '0';
    public $memcached_server_host = 'localhost';
    public $memcached_server_port = '11211';
    public $redis_persist = '1';
    public $redis_server_host = 'localhost';
    public $redis_server_port = '6379';
    public $redis_server_auth = '';
    public $redis_server_db = '0';
    public $proxy_enable = '0';
    public $proxy_host = '';
    public $proxy_port = '';
    public $proxy_user = '';
    public $proxy_pass = '';
    public $massmailoff = '0';
    public $session_memcache_server_host = 'localhost';
    public $session_memcache_server_port = '11211';
    public $session_memcached_server_host = 'localhost';
    public $session_memcached_server_port = '11211';
    public $frontediting = '1';
    public $asset_id = '1';

这里是 index.php 文件:

<?php
    define('JOOMLA_MINIMUM_PHP', '5.3.10');

if (version_compare(PHP_VERSION, JOOMLA_MINIMUM_PHP, '<'))

    die('Your host needs to use PHP ' . JOOMLA_MINIMUM_PHP . ' or higher to run this version of Joomla!');


// Saves the start time and memory usage.
$startTime = microtime(1);
$startMem  = memory_get_usage();

/**
 * Constant that is checked in included files to prevent direct access.
 * define() is used in the installation folder rather than "const" to not error for PHP 5.2 and lower
 */
define('_JEXEC', 1);

if (file_exists(__DIR__ . '/defines.php'))

    include_once __DIR__ . '/defines.php';


if (!defined('_JDEFINES'))

    define('JPATH_BASE', __DIR__);
    require_once JPATH_BASE . '/includes/defines.php';


require_once JPATH_BASE . '/includes/framework.php';

// Set profiler start time and memory usage and mark afterLoad in the profiler.
JDEBUG ? $_PROFILER->setStart($startTime, $startMem)->mark('afterLoad') : null;

// Instantiate the application.
$app = JFactory::getApplication('site');

// Execute the application.
$app->execute();

我想知道我的网站没有在 localhost 上运行的原因? 感谢您的帮助。

【问题讨论】:

【参考方案1】:

将mysql文件夹移动到另一个挂载后我遇到了同样的错误,我不得不将configuration.php中的$host从'localhost'更改为'127.0.0.1',解决了它。

【讨论】:

【参考方案2】:

正如我在你看到的配置 $host 是正确的,所以它可能是不同的原因。但对我来说,解决方案是删除 $host 变量中 configuration.php 中的 : 符号。

【讨论】:

以上是关于在 Joomla 上出现错误:无法读取会话数据和应用程序实例化错误的主要内容,如果未能解决你的问题,请参考以下文章

php session.php 错误 Joomla

joomla公共服务器上的css、js文件和图像出现403错误

IBM MobileFirst:无法读取存储库

Joomla3.6致命错误:require_once():需要打开失败

Charles Web 代理在 Mac OS 上读取但不写入会话

无法在 React.js 中读取 json,出现意外的令牌错误