试图让f3工作

时间:2014-09-10 19:59:39

标签: php fat-free-framework

我想开始使用f3并将其下载并将其放入我的webroot中,但是当我运行它时,我只是一直收到404错误

下面的

是示例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();

这是我的.htaccess文件

# 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]

这是我的apache虚拟主机配置

<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>

我还通过运行a2enmod rewrite

启用了mod_rewrite

0 个答案:

没有答案