![](/img/trans.png)
[英]EC2 Ubuntu mysql_connect function causing 500 Internal Server Error
[英]CakePhp application gives 500 Server Error on EC2 Ubuntu Instance
我使用纯文本代码和Cake使用PHP MySQL创建了一个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
error.log告诉您问题出在哪里
/var/www/app/tmp/cache/persistent/ is not writable
文件夹权限未正确设置。
在您的外壳上运行以下命令
chmod -R 777 /var/www/app/tmp/
这将允许写入Cake工作所需的tmp文件夹
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.