2

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

索引.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
4

1 回答 1

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();
    ?>

但恕我直言,这不是一个很好的解决方案。我更喜欢下一个: 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

于 2012-12-25T22:34:50.670 回答