我正在Ubuntu 18.04 LTS上使用php 7.2运行Apache 2.4.29。我的数据文件(/ var / www / cake / prod / webroot /)是从Apache 2.2.20迁移而PHP 5运行在Ubuntu 11.10上的。
我的apache服务运行正常,但是当我尝试访问网站(https://my_ip:8080/users/login)时,它显示: my_ip当前无法处理此请求。
我用以下错误消息检查Apache错误日志:
[2019年12月20日星期五05:52:47.177805] [php7:error] [pid 10916] [client 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 :(得分:0)
根据index.php
文件,此版本的CakePHP与PHP版本4和5兼容,并且服务器上已安装PHP 7.2。
您应该将CakePHP更新到与PHP 7.2兼容的最新可用版本。