Ubuntu PHP致命错误:未捕获错误:未找到类“ cake \\ lib \\ Dispatcher”

时间:2019-12-31 01:36:20

标签: php apache class ubuntu cakephp

我已经建立了一个新的Ubuntu 18.04 LTS服务器,该服务器运行Apache 2.4.29,php 7.2和cakephp 4.0。我已经从在Ubuntu 11.10的旧服务器上运行的网站上迁移了数据文件(/ var / www / cake / prod / webroot /),该网站使用Apache 2.2.20,php 5和cakephp 1.3.7-1。

我已经迁移了/ var / www / cake的整个数据文件。

我的apache服务运行正常,但是当我尝试访问网站(https://my_ip:8080/users/login)时,它显示: my_ip当前无法处理此请求。

我用以下错误消息检查Apache错误日志:

  

[2019年12月20日星期五05:52:47.177805] [php7:错误] [pid 10916] [客户端ip:19466] PHP致命错误:未捕获的错误:在/ var / www / cake /中找不到类'Dispatcher' prod / webroot / index.php:82 \ n堆栈跟踪:\ n#0 {main} \ n在第82行的/var/www/cake/prod/webroot/index.php中抛出

/var/www/cake/prod/webroot/index.php的内容

<?php
/**
 * Index
 *
 * The Front Controller for handling every request
 *
 * PHP versions 4 and 5
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       cake
 * @subpackage    cake.app.webroot
 * @since         CakePHP(tm) v 0.2.9
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
/**
 * Use the DS to separate the directories in other defines
 */
if (!defined('DS')) {
    define('DS', DIRECTORY_SEPARATOR);
}
/**
 * These defines should only be edited if you have cake installed in
 * a directory layout other than the way it is distributed.
 * When using custom settings be sure to use the DS and do not add a trailing DS.
 */

/**
 * The full path to the directory which holds "app", WITHOUT a trailing DS.
 *
 */
if (!defined('ROOT')) {
    define('ROOT', dirname(dirname(dirname(__FILE__))));
}
/**
 * The actual directory name for the "app".
 *
 */
if (!defined('APP_DIR')) {
define('APP_DIR', basename(dirname(dirname(__FILE__))));
}
/**
 * The absolute path to the "cake" directory, WITHOUT a trailing DS.
 *
 */
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
    define('CAKE_CORE_INCLUDE_PATH', ROOT);
}

/**
 * Editing below this line should NOT be necessary.
 * Change at your own risk.

*/
if (!defined('WEBROOT_DIR')) {
    define('WEBROOT_DIR', basename(dirname(__FILE__)));
}
if (!defined('WWW_ROOT')) {
    define('WWW_ROOT', dirname(__FILE__) . DS);
}
if (!defined('CORE_PATH')) {
    if (function_exists('ini_set') && ini_set('include_path', CAKE_CORE_INCLUDE_PATH . PATH_SEPARATOR . ROOT . DS . APP_DIR . DS . PATH_SEPARATOR . ini_get('include_path'))) {
      define('APP_PATH', null);
      define('CORE_PATH', null);
    } else {
        define('APP_PATH', ROOT . DS . APP_DIR . DS);
        define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
    }
}
if (!include(CAKE_CORE_INCLUDE_PATH . DS . 'prod' . DS . 'config' . DS . 'bootstrap.php')) {
    trigger_error("CakePHP core could not be found.  Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php.  It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vend$
}
if (isset($_GET['url']) && $_GET['url'] === 'favicon.ico') {
    return;
} else {
    $Dispatcher = new Dispatcher();
    $Dispatcher->dispatch();
}

/etc/apache2/sites-enabled/000-default.conf的内容

<VirtualHost *:8080>
    ServerAdmin webmaster@localhost

    SSLEngine on
    <FilesMatch ".(cgi|shtml|phtml|php)$">
    SSLOptions +StdEnvVars
    </FilesMatch>
    <Directory /usr/lib/cgi-bin>
    SSLOptions +StdEnvVars
    </Directory>

    DocumentRoot /var/www/cake/prod/webroot

    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/cake/prod/webroot>
        SSLRequireSSL
        Options Indexes FollowSymLinks MultiViews
        AllowOverride all
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    SSLCertificateFile /etc/apache2/ssl/apache.crt
    SSLCertificateKeyFile /etc/apache2/ssl/apache.key

    SSLVerifyClient none
    SSLProxyEngine off

    Include /var/www/foswiki/foswiki_httpd_conf.txt
    <IfModule mime.c>
    AddType application/x-x509-ca-cert      .crt
    AddType application/x-pkcs7-crl         .crl
    </IfModule>

</VirtualHost>

0 个答案:

没有答案