Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/grails/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP致命错误:未捕获错误:Class';蛋糕\\lib\\Dispatcher';找不到_Php_Apache_Cakephp_Ubuntu 18.04_Dispatcher - Fatal编程技术网

PHP致命错误:未捕获错误:Class';蛋糕\\lib\\Dispatcher';找不到

PHP致命错误:未捕获错误:Class';蛋糕\\lib\\Dispatcher';找不到,php,apache,cakephp,ubuntu-18.04,dispatcher,Php,Apache,Cakephp,Ubuntu 18.04,Dispatcher,我正在Ubuntu 18.04 LTS上运行Apache2.4.29和PHP7.2。我的数据文件(/var/www/cake/prod/webroot/)是从Apache2.2.20迁移而来的,在Ubuntu11.10上运行PHP5 我的apache服务运行正常,但当我尝试访问网站()时,它显示: 我的ip当前无法处理此请求。 我检查Apache错误日志,并显示以下错误消息: [Fri Dec 20 05:52:47.177805 2019][php7:error][pid 10916][cli

我正在Ubuntu 18.04 LTS上运行Apache2.4.29和PHP7.2。我的数据文件(/var/www/cake/prod/webroot/)是从Apache2.2.20迁移而来的,在Ubuntu11.10上运行PHP5

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

我检查Apache错误日志,并显示以下错误消息:

[Fri Dec 20 05:52:47.177805 2019][php7:error][pid 10916][client ip:19466]PHP致命错误:未捕获错误:在/var/www/cake/prod/webroot/index.PHP中找不到类“Dispatcher”。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();
}

根据
index.php
文件,此版本的CakePHP与php版本4和5兼容,服务器上安装了php 7.2


您应该将CakePHP更新到与PHP7.2兼容的最新可用版本。

您是否从另一台服务器复制了该站点?如果是这样的话,您是从
/var/www/cake
复制了所有内容,还是只是从
/var/www/cake/prod/webroot
复制了所有内容?另外,这运行的是什么版本的CakePHP?apache配置与您的问题无关。这看起来像是CakePHP的旧版本,看起来很匹配。
include\u path
设置为什么,该路径中是否存在文件?实际上,根据错误,禁用了
ini\u set
,您需要显式地包含Dispatcher类。我已复制了/var/www/cake中的所有文件。这是下一个要面对的问题(),但这并没有解决(隐含的)问题问到为什么第一次尝试加载类失败的问题。cakephp版本是4.0.0i,包含行
require LIBS'php'错误消息是:
[[php7:warn][pid 26159][client:23707]PHP警告:使用未定义的常量LIBS-假定为'LIBS'(这将在PHP的未来版本中引发错误),位于/var/www/cake/prod/webroot/index.PHP的第82[][php7:warn][pid 26159][client:23707]PHP警告:require(LIBSdispatcher.PHP):无法打开流:第82行的/var/www/cake/prod/webroot/index.php中没有这样的文件或目录
还有以下内容:
[[php7:error][pid 26159][client:23707]php致命错误:require():无法打开必需的“LIBSdispatcher.php”(include_path='/var/www/cake:/var/www/cake/prod/::/usr/share/php'))在第82行的/var/www/cake/prod/webroot/index.php中
<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>