Sto usando Silex per la prima volta. Tutto funziona bene durante lo sviluppo locale. Una volta caricato tutto sul server di produzione, i percorsi parametrizzati non funzionano più.Routing Silex non trovato
Avete qualche idea?
Mi mancano da qualche parte le configurazioni di produzione?
Mi mancano i permessi dei file da qualche parte?
che sto ricevendo quelle due eccezioni:
NotFoundHttpException: No route found for "GET /prevendita/hello/sadfasdf"
in /var/www/vhosts/teatrodellamemoria.it/httpdocs/assets/modules/prevendita/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/RouterListener.php line 92
at RouterListener->onKernelRequest(object(GetResponseEvent))
at call_user_func(array(object(RouterListener), 'onKernelRequest'), object(GetResponseEvent)) in /var/www/vhosts/teatrodellamemoria.it/httpdocs/assets/modules/prevendita/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php line 164
at EventDispatcher->doDispatch(array(array(object(Application), 'onEarlyKernelRequest'), array(object(SessionServiceProvider), 'onEarlyKernelRequest'), array(object(RouterListener), 'onKernelRequest'), array(object(LocaleListener), 'onKernelRequest'), array(object(Application), 'onKernelRequest')), 'kernel.request', object(GetResponseEvent)) in /var/www/vhosts/teatrodellamemoria.it/httpdocs/assets/modules/prevendita/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php line 53
at EventDispatcher->dispatch('kernel.request', object(GetResponseEvent)) in /var/www/vhosts/teatrodellamemoria.it/httpdocs/assets/modules/prevendita/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php line 110
at HttpKernel->handleRaw(object(Request), '1') in /var/www/vhosts/teatrodellamemoria.it/httpdocs/assets/modules/prevendita/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php line 73
at HttpKernel->handle(object(Request), '1', true) in /var/www/vhosts/teatrodellamemoria.it/httpdocs/assets/modules/prevendita/vendor/silex/silex/src/Silex/Application.php line 509
at Application->handle(object(Request)) in /var/www/vhosts/teatrodellamemoria.it/httpdocs/assets/modules/prevendita/vendor/silex/silex/src/Silex/Application.php line 484
at Application->run() in /var/www/vhosts/teatrodellamemoria.it/httpdocs/assets/modules/prevendita/web/index.php line 49
E:
ResourceNotFoundException:
in /var/www/vhosts/teatrodellamemoria.it/httpdocs/assets/modules/prevendita/vendor/symfony/routing/Symfony/Component/Routing/Matcher/UrlMatcher.php line 81
at UrlMatcher->match('/prevendita/hello/sadfasdf') in /var/www/vhosts/teatrodellamemoria.it/httpdocs/assets/modules/prevendita/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RedirectableUrlMatcher.php line 30
at RedirectableUrlMatcher->match('/prevendita/hello/sadfasdf') in /var/www/vhosts/teatrodellamemoria.it/httpdocs/assets/modules/prevendita/vendor/silex/silex/src/Silex/LazyUrlMatcher.php line 51
at LazyUrlMatcher->match('/prevendita/hello/sadfasdf') in /var/www/vhosts/teatrodellamemoria.it/httpdocs/assets/modules/prevendita/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/RouterListener.php line 78
at RouterListener->onKernelRequest(object(GetResponseEvent))
at call_user_func(array(object(RouterListener), 'onKernelRequest'), object(GetResponseEvent)) in /var/www/vhosts/teatrodellamemoria.it/httpdocs/assets/modules/prevendita/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php line 164
at EventDispatcher->doDispatch(array(array(object(Application), 'onEarlyKernelRequest'), array(object(SessionServiceProvider), 'onEarlyKernelRequest'), array(object(RouterListener), 'onKernelRequest'), array(object(LocaleListener), 'onKernelRequest'), array(object(Application), 'onKernelRequest')), 'kernel.request', object(GetResponseEvent)) in /var/www/vhosts/teatrodellamemoria.it/httpdocs/assets/modules/prevendita/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php line 53
at EventDispatcher->dispatch('kernel.request', object(GetResponseEvent)) in /var/www/vhosts/teatrodellamemoria.it/httpdocs/assets/modules/prevendita/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php line 110
at HttpKernel->handleRaw(object(Request), '1') in /var/www/vhosts/teatrodellamemoria.it/httpdocs/assets/modules/prevendita/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php line 73
at HttpKernel->handle(object(Request), '1', true) in /var/www/vhosts/teatrodellamemoria.it/httpdocs/assets/modules/prevendita/vendor/silex/silex/src/Silex/Application.php line 509
at Application->handle(object(Request)) in /var/www/vhosts/teatrodellamemoria.it/httpdocs/assets/modules/prevendita/vendor/silex/silex/src/Silex/Application.php line 484
at Application->run() in /var/www/vhosts/teatrodellamemoria.it/httpdocs/assets/modules/prevendita/web/index.php line 49
Questo è il codice: server di sviluppo
<?php
require_once __DIR__.'/../vendor/autoload.php';
use Teatro\Models\Reservation;
use Teatro\Models\ReservationsSeat;
use Symfony\Component\Validator\Constraints;
use Symfony\Component\Form\FormError;
$app = new Silex\Application();
$app['debug'] = true;
$app->register(new Silex\Provider\TwigServiceProvider(), array(
'twig.path' => __DIR__.'/../views',
));
$app->register(
new Silex\Provider\UrlGeneratorServiceProvider()
);
$app->register(
new Silex\Provider\SessionServiceProvider(), array(
// 'session.storage.options' => array('name' => 'test')
)
);
$app->register(
new Silex\Provider\FormServiceProvider()
);
$app->register(
new Silex\Provider\ValidatorServiceProvider()
);
$app->register(new Silex\Provider\TranslationServiceProvider(), array(
'translator.messages' => array(),
));
$app->register(
new Silex\Provider\SwiftmailerServiceProvider()
);
$app->get('/prevendita/hello/{name}/', function ($name) use ($app) {
return "Hello $name!";
})->bind('hello_name');
$app->get('/prevendita/hello', function() use ($app) {
return "Hello!";
})->bind('hello');
$app->run();
è PHP 5.4 server web incorporato del server di produzione è PHP 5.3 CentOS
I file .htaccess sono praticamente gli stessi. Nel env di produzione, l'applicazione selce è in una sottocartella di radice del documento diciamo/prevendita così ho aggiunto
RewriteRule ^prevendita /prevendita/web/index.php [L]
per reindirizzare qualsiasi richiesta a partire da/prevendita alla mia selce app
È possibile incollare gli stacktraces? – Florent
In base alla seconda eccezione, nessuna corrispondenza corrisponde. Forse puoi incollare i tuoi percorsi? – Florent
problema è localmente lo stesso file funziona perfettamente.Oltre a questo, funziona perfettamente in produzione se il percorso è statico. Se aggiungo un parametro nel percorso, viene indicato il percorso non trovato. – user1170896