CakePhp应用程序在EC2 Ubuntu实例上提供500服务器错误

时间:2013-08-28 08:01:10

标签: php cakephp ubuntu amazon-ec2 internal-server-error

我使用PHP MySQL在普通代码和使用Cake制作了一个Web应用程序。当我将代码上传到Ubuntu EC2实例时,它可以正常使用数据库,但是在我上传Cake目录之后,它给了我500个服务器错误。

我尝试了/添加到所有3个htaccess文件但没有效果。需要注意的是,当我上传所有文件时,它会在实例上显示常规索引。但是一旦上传主index.php文件,它就会开始显示错误。所以我假设它与index.php中设置的路径有关。请帮忙!

我在Windows 7机器上的XAMPP中制作了cakePHP应用程序。它可能与服务器上php.ini文件中的错误指令/其他内容有关吗?

这是我的index.php文件内容:

define('APP_DIR', 'app');
define('DS', DIRECTORY_SEPARATOR);
define('ROOT', dirname(__FILE__));
define('WEBROOT_DIR', 'webroot');
define('WWW_ROOT', ROOT . DS . APP_DIR . DS . WEBROOT_DIR . DS);

if (!defined('ROOT')) {
    define('ROOT', DS.'var'.DS.'www');
}
if (!defined('APP_DIR')) {
    define('APP_DIR', 'app');
}
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
    define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');
}

require APP_DIR . DS . WEBROOT_DIR . DS . 'index.php';

这是错误日志:每当我刷新

时都会重复此错误
[Wed Aug 28 09:26:38 2013] [error] [client xxxxxxx] PHP Warning:  /var/www/app/tmp/cache/persistent/ is not writable in /var/www/lib/Cake/Cache/Engine/FileEngine.php on line 337
[Wed Aug 28 09:26:38 2013] [error] [client xxxxxxx] PHP Fatal error:  Uncaught exception 'CacheException' with message 'Cache engine _cake_core_ is not properly configured.' in /var/www/lib/Cake/Cache/Cache.php:166Stack trace:
#0 /var/www/lib/Cake/Cache/Cache.php(136): Cache::_buildEngine('_cake_core_')
#1 /var/www/app/Config/core.php(336): Cache::config('_cake_core_', Array)
#2 /var/www/lib/Cake/Core/Configure.php(78): include('/var/www/app/Co...')
#3 /var/www/lib/Cake/bootstrap.php(171): Configure::bootstrap(true)
#4 /var/www/app/webroot/index.php(96): include('/var/www/lib/Ca...')
#5 /var/www/index.php(43): require('/var/www/app/we...')
#6 {main}
  thrown in /var/www/lib/Cake/Cache/Cache.php on line 166

1 个答案:

答案 0 :(得分:1)

error.log告诉你问题是什么

/var/www/app/tmp/cache/persistent/ is not writable 

文件夹权限尚未正确设置。

在shell上运行以下命令

chmod -R 777 /var/www/app/tmp/

这将允许写入Cake运行所需的tmp文件夹