I was following the tutorials for symfony, and have hit a road block.
my setup is the current version of xampp (running on windows), so my apache and php are relatively up to date.
following their "quick tour" here:
http://symfony.com/doc/current/quick_tour/the_big_picture.html
everything worked great in the development environment. following the guides a little further however, i started creating my own test bundle via the guide here:
http://symfony.com/doc/current/book/page_creation.html
and can't get it to work properly on the production environment. (it works fine in the dev environment, just like the pre-installed demos did.
i have tried clearing the cache via the php app/console cache:clear --env=prod --no-debug command, however that did not help (and also seems to be the only suggestion that pops up upon searching.
when viewing the routes, i can see that my "/hello/{name}" route is showing up fine on the list of routes.
my app/config/routing.yml has:
acme_hello:
resource: "@AcmeHelloBundle/Resources/config/routing.yml"
prefix: /
as it should, and then my src/Acme/HelloBundle/Resources/config/routing.yml has
hello:
path: /hello/{name}
defaults: { _controller: AcmeHelloBundle:Hello:index }
does anyone have any suggestions as to what the problem might be? (i have also tried converting the out of the box demo to a production route, by copying the route info from the routing_dev.yml file and reassigning the bundle in the appkernel.php file, but that had the same problem)
---edit---
per request, here is my appkernel.php file
use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new JMS\AopBundle\JMSAopBundle(),
new JMS\DiExtraBundle\JMSDiExtraBundle($this),
new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
new Acme\HelloBundle\AcmeHelloBundle(),
new Acme\DemoBundle\AcmeDemoBundle(),
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
}
return $bundles;
}
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
}
}
---2nd edit---
i found the problem. i thought it was strange that nothing was showing up in the prod log, so i thought maybe something was redirecting me, causing me to miss the app.php file entirely.
it turns out, this was the problem. i emptied the contents of the .htaccess file that was in the web folder (the one that symfony came preconfigured with) and then everything magically started working.
I also had the same problem. I share how I solved it (Strange but it works).
In file web/app.php change:
$kernel = new AppKernel('prod', false);
by
$kernel = new AppKernel('prod', true); // Enable debug mode
Then load the page in the browser (in app environment) and change the file again disabling debug:
$kernel = new AppKernel('prod', false);
Try loading the page in the browser again. It should work properly.
Best regards,
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With