简体   繁体   English

使用锂框架和mongodb的服务器错误500

[英]Server error 500 using lithium framework and mongodb

I seem to get the 500 error when trying to query the database (mongodb) if I remove the query it display the view fine. 尝试查询数据库(mongodb)时,如果删除查询,它显示的视图很好,但似乎出现500错误。 From using the quick start guide and other online tutorials I carnt see that I am doing anything wrong. 通过使用快速入门指南和其他在线教程,我看得出我做错了什么。

Model - Posts.php 模型 -Posts.php

<?php

namespace app\models;

class Posts extends \lithium\data\Model {

}

Controller - PostsController.php 控制器 -PostsController.php

<?php
/**
 * Lithium: the most rad php framework
 *
 * @copyright     Copyright 2015, Union of RAD (http://union-of-rad.org)
 * @license       http://opensource.org/licenses/bsd-license.php The BSD License
 */

namespace app\controllers;

use app\models\Posts;

class PostsController extends \lithium\action\Controller {

    public function index() {

        $posts = Posts::find('all', array(
            'conditions' => array('author' => 'tom')
        ));

        return $this->render(array('layout' => false));
    }

}

?>

View - index.html.php 查看 -index.html.php

Contains some text no php as trying to get it working first. 包含一些没有PHP的文本,因为它试图使其首先工作。

Is it possible you don't have MongoDB installed? 您可能没有安装MongoDB吗? It's also possible this has something to do with mod_rewrite (AllowOverride comes to mind). 这也可能与mod_rewrite有关(想到了AllowOverride)。 Your best bet is to look at your logs. 最好的选择是查看日志。

The location of your logs depends on what you're using. 日志的位置取决于您使用的内容。 If you're using Apache2 on Ubuntu, it would be located in /var/log/apache2. 如果您在Ubuntu上使用Apache2,它将位于/ var / log / apache2中。

Run this in your terminal while refreshing your page: tail -f /var/log/apache2/error.log where error.log is assumed to be the log file name. 刷新页面时,在终端中运行此命令: tail -f /var/log/apache2/error.log ,其中将error.log假定为日志文件名。 As you refresh your page, you should be able to see the error in your terminal. 刷新页面时,您应该能够在终端中看到错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM