I have a Silex 2.0 application with PHP 7.0 and Apache 2.4 (on port 8080) with the following structure:
silex/
| - vendor/
| - web/
| - index.php
| - composer.json
| - .htaccess
composer.json
{
"require": {
"php": ">=7",
"silex/silex": "~2.0"
}
}
.htaccess
FallbackResource /silex/web/index.php
web / index.php
<?php
define('APP_ROOT', dirname(__DIR__));
chdir(APP_ROOT);
use Silex\Application;
require 'vendor/autoload.php';
$app = new Application();
$app['debug'] = true;
echo "---------------- I am here! -----------------";
$app->get('/', function() use ($app) {
echo 'inside get';
return $app->json(['Hello World!']);
});
$app->run();
And the problem is this:
What am I doing wrong?