I code with fat-free-framework and I try use this structure
app/
vendor/
public/
index.php
composer.json
{
"require": {
"bcosca/fatfree": "^3.7"
},
"autoload": {
"psr-4": { "App\\": "app/" }
}
}
with local server php -S 127.0.0.1:8000 -t public/ my site is displayed correctly but is a deploy on remote server with a subdomain.domain.com I have classic error
HTTP 404 (GET /test)
[hb/vendor/bcosca/fatfree/lib/base.php:1716] Base->error()
[hb/public/index.php:34] Base->run()
if I try to call a class in my namespace App I have an error
Internal Server Error
Class 'App\Test' not found [/home/clients/zzz/web/test/public/index.php:26]
[/home/clients/zzz/web/test/vendor/bcosca/fatfree/lib/base.php:1955] {closure}()
[/home/clients/zzz/web/test/vendor/bcosca/fatfree/lib/base.php:1754] Base->call()
[index.php:35] Base->run()
my .htaccess in folder public with index.php is:
RewriteEngine On
RewriteBase /
RewriteRule ^(app|tmp)\/|\.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]
thank you all
in your public/index.php, change the current working dir back to the project root path before doing anything else:
chdir('../');
that should fix it.