簡體   English   中英

使用鋰框架和mongodb的服務器錯誤500

[英]Server error 500 using lithium framework and mongodb

嘗試查詢數據庫(mongodb)時,如果刪除查詢,它顯示的視圖很好,但似乎出現500錯誤。 通過使用快速入門指南和其他在線教程,我看得出我做錯了什么。

模型 -Posts.php

<?php

namespace app\models;

class Posts extends \lithium\data\Model {

}

控制器 -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));
    }

}

?>

查看 -index.html.php

包含一些沒有PHP的文本,因為它試圖使其首先工作。

您可能沒有安裝MongoDB嗎? 這也可能與mod_rewrite有關(想到了AllowOverride)。 最好的選擇是查看日志。

日志的位置取決於您使用的內容。 如果您在Ubuntu上使用Apache2,它將位於/ var / log / apache2中。

刷新頁面時,在終端中運行此命令: tail -f /var/log/apache2/error.log ,其中將error.log假定為日志文件名。 刷新頁面時,您應該能夠在終端中看到錯誤。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM