Domanda

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
È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top