0
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 that’s the problem:
What am I doing wrong?
Vlw man! I tested solution 2 and 3 to see if it worked, both correct. Solution 1 I didn’t even want to test, because I don’t want to keep creating a Virtualhost for every project I might create. I will use Solution 2, thank you!
– LeoFelipe
I’m glad it worked out! D
– Leonardo Cesar Teixeira