Fat Free示例示例失败

时间:2012-12-21 20:53:27

标签: php fat-free-framework

我正在尝试运行非常简单的无脂肪示例,但没有成功,

的index.php:

<?php
        $f3=require('fatfree/lib/base.php');
        $f3->route('GET /',
            function() {
                echo 'Hello, world!';
            }
        );
        $f3->run();
?>

.htaccess内容:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php [L,QSA]

错误日志:

[Fri Dec 21 20:50:11 2012] [error] [client 127.0.0.1] - /var/www/html/index.php:2 require('/var/www/html/fatfree/lib/base.php')
[Fri Dec 21 20:50:11 2012] [error] [client 127.0.0.1] PHP Fatal error:  Uncaught exception 'ErrorException' with message 'Undefined index: ONERROR' in /var/www/html/fatfree/lib/base.php:1252
Stack trace:\n#0 /var/www/html/fatfree/lib/base.php(790): Base->{closure}(8, 'Undefined index...', '/var/www/html/f...', 790, Array)
#1 /var/www/html/fatfree/lib/base.php(1246): Base->error(500, 'date_default_ti...', Array)
#2 [internal function]: Base->{closure}(Object(ErrorException))
#3 {main}
  thrown in /var/www/html/fatfree/lib/base.php on line 1252

1 个答案:

答案 0 :(得分:2)

我遇到了同样的问题并查看我的/ var / log / httpd / error_log我注意到我只需要设置时区。我找到了两种方法: 1)只需在index.php文件的开头调用date_default_timezone_set()函数,如下所示:

    <?php
    date_default_timezone_set('Europe/Rome'); //That's my timezone, choose the right one
    $f3=require('fatfree/lib/base.php');
    $f3->route('GET /',
        function() {
            echo 'Hello, world!';
        }
    );
    $f3->run();
    ?>

但imho不是一个好的解决方案。我更喜欢下一个: 2)找到你的php.ini文件(在Fedora 17中的/ etc /里面)并修改这些行:

    [Date]
    ; Defines the default timezone used by the date functions
    ; http://php.net/date.timezone
    ;date.timezone = 
像这样:

    [Date]
    ; Defines the default timezone used by the date functions
    ; http://php.net/date.timezone
    date.timezone = 'Europe/Rome'

使用

保存然后重新启动httpd服务
    sudo service httpd restart

我希望它有所帮助:D