Php 试着让f3开始工作

Php 试着让f3开始工作,php,fat-free-framework,Php,Fat Free Framework,我想开始使用f3,我下载了它并把它放在我的webroot中,但当我运行它时,我总是得到一个404错误 下面是index.php示例 这是我的apache虚拟主机配置 服务器管理员webmaster@localhost 服务器名www.test.com DocumentRoot/var/www/www.test.com 选项如下符号链接 不允许超限 选项索引跟随符号链接多视图 允许超越所有 命令允许,拒绝 通融 ScriptAlias/cgi-bin//usr/lib/cgi-bin/ 不允许超

我想开始使用f3,我下载了它并把它放在我的webroot中,但当我运行它时,我总是得到一个404错误

下面是index.php示例 这是我的apache虚拟主机配置

服务器管理员webmaster@localhost
服务器名www.test.com
DocumentRoot/var/www/www.test.com
选项如下符号链接
不允许超限
选项索引跟随符号链接多视图
允许超越所有
命令允许,拒绝
通融
ScriptAlias/cgi-bin//usr/lib/cgi-bin/
不允许超限
选项+执行CGI-多视图+符号链接所有者匹配
命令允许,拒绝
通融
ErrorLog${APACHE_LOG_DIR}/www.test.com-error.LOG
#可能的值包括:调试、信息、通知、警告、错误、临界值、,
#警惕,埃默格。
日志级别警告
CustomLog${APACHE_LOG_DIR}/www.test.com-access.LOG组合

我还通过运行a2enmod rewrite启用了mod_rewrite

如果在子文件夹中运行,请尝试取消对
RewriteBase
指令的注释,并将其设置为正确的文件夹。但即使没有这一点,
/
路线也应该是可行的。你能澄清一下哪个路由会引发404吗?这是我运行它index.php:80 Base->run()时唯一显示的内容,但你到底是如何运行它的?如果您正在呼叫
http://localhost/
它应该可以工作。但是如果您正在呼叫
http://localhost/index.php
不会。你是对的,这就是问题所在。我没有意识到我不能用index.php调用它
<?php

$f3=require('lib/base.php');

$f3->set('DEBUG',1);
if ((float)PCRE_VERSION<7.9)
    trigger_error('PCRE version is out of date');

$f3->config('config.ini');

$f3->route('GET /',
    function($f3) {
        $classes=array(
            'Base'=>
                array(
                    'hash',
                    'json',
                    'session'
                ),
            'Cache'=>
                array(
                    'apc',
                    'memcache',
                    'wincache',
                    'xcache'
                ),
            'DB\SQL'=>
                array(
                    'pdo',
                    'pdo_dblib',
                    'pdo_mssql',
                    'pdo_mysql',
                    'pdo_odbc',
                    'pdo_pgsql',
                    'pdo_sqlite',
                    'pdo_sqlsrv'
                ),
            'DB\Jig'=>
                array('json'),
            'DB\Mongo'=>
                array(
                    'json',
                    'mongo'
                ),
            'Auth'=>
                array('ldap','pdo'),
            'Bcrypt'=>
                array(
                    'mcrypt',
                    'openssl'
                ),
            'Image'=>
                array('gd'),
            'Lexicon'=>
                array('iconv'),
            'SMTP'=>
                array('openssl'),
            'Web'=>
                array('curl','openssl','simplexml'),
            'Web\Geo'=>
                array('geoip','json'),
            'Web\OpenID'=>
                array('json','simplexml'),
            'Web\Pingback'=>
                array('dom','xmlrpc')
        );
        $f3->set('classes',$classes);
        $f3->set('content','welcome.htm');
        echo View::instance()->render('layout.htm');
    }
);

$f3->route('GET /userref',
    function($f3) {
        $f3->set('content','userref.htm');
        echo View::instance()->render('layout.htm');
    }
);

$f3->run();
# Enable rewrite engine and route requests to framework
RewriteEngine On

# Some servers require you to specify the `RewriteBase` directive
# In such cases, it should be the path (relative to the document root)
# containing this .htaccess file
#
#RewriteBase /

RewriteCond %{REQUEST_URI} \.ini$
RewriteRule \.ini$ - [R=404]

RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L,QSA]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
<VirtualHost 192.168.1.10>
        ServerAdmin webmaster@localhost
        ServerName www.test.com
        DocumentRoot /var/www/www.test.com
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/www.test.com>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/www.test.com-error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/www.test.com-access.log combined
</VirtualHost>