douwa0280 2013-08-28 08:01
浏览 43
已采纳

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

I made a web app using PHP MySQL in both plain code and also using Cake. When I upload the code to Ubuntu EC2 instance, it works fine with the database and all but after I upload Cake directory in it's place, it's giving me 500 server error.

I tried the / addition to all 3 htaccess files but no effect. To be noted, When I upload all the files it's showing regular index of on the instance. But as soon as the main index.php file is uploaded it starts showing error. So I'm assuming it has something to do with the paths set in index.php or something. Please help!

I made the cakePHP app in XAMPP on a windows 7 machine. could it have anything to do with error directives/something else in php.ini file on the server?

Here's my index.php file content:

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';

Here's the error log: This error repeats whenever I refresh

[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条回答 默认 最新

  • dtvnnhh8992 2013-08-28 09:44
    关注

    The error.log tells you what the problem is

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

    Folder permissions have not been set up correctly.

    Run the following command on your shell

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

    This will allow writing to the tmp folder which is required for Cake to work

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 求数据集和代码#有偿答复
  • ¥15 关于下拉菜单选项关联的问题
  • ¥20 java-OJ-健康体检
  • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况
  • ¥15 画两个图 python或R