Error:symfony 3 Uncaught Twig_Error_Loader: [duplicate] - symfony

This question already has an answer here:
Symfony2: ResourceNotFoundException when using extends in a twig template
(1 answer)
Closed 4 years ago.
i downloaded a Symfony project from my friends run both
Composer update and php bin/console doctrine:schema:update --force
commands without errors
but when i open the project on my browser i get this error:
Fatal error: Uncaught Symfony\Component\Routing\Exception\ResourceNotFoundException in /Applications/MAMP/htdocs/Animaux/Animaux/var/cache/prod/appProdProjectContainerUrlMatcher.php:407 Stack trace: #0 /Applications/MAMP/htdocs/Animaux/Animaux/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/UrlMatcher.php(90): appProdProjectContainerUrlMatcher->match('/app_dev.app/') #1 /Applications/MAMP/htdocs/Animaux/Animaux/vendor/symfony/symfony/src/Symfony/Component/Routing/Router.php(262): Symfony\Component\Routing\Matcher\UrlMatcher->matchRequest(Object(Symfony\Component\HttpFoundation\Request)) #2 /Applications/MAMP/htdocs/Animaux/Animaux/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php(104): Symfony\Component\Routing\Router->matchRequest(Object(Symfony\Component\HttpFoundation\Request)) #3 [internal function]: Symfony\Component\HttpKernel\EventListener\RouterListener->onKernelRequest(Object(Symfony\Component\HttpKernel\Event\GetResponseEvent), 'kernel.request', Object(Symfony\ in /Applications/MAMP/htdocs/Animaux/Animaux/vendor/twig/twig/lib/Twig/Loader/Filesystem.php on line 101
help me please

Composer update - It is a bad idea. For normal development or migrate to production, you need to use the same version of dependencies, with the project must be provided composer.lock file (versions of dependencies), and you need to use composer install instead of Composer update.
...Animaux/var/cache/prod/app... it meant you didn't clear the cache, for development use https://your_host.com/app_dev.php for production - clear the cache php bin/console cache:clear -e prod
Check for PHP version, it must be the same of development.

Related

Symfony deployment: error code 255 with composer install --no-dev

Here are the steps, I am following:
Cloning my repository from github
git clone https://github.com/EresDev/EresNoteSymfony.git .
Updating .env file with APP_ENV=prod
Then performing install
composer install --no-dev
I get following error:
.
.
.
- Installing symfony/translation (v4.2.4): Loading from cache
- Installing symfony/validator (v4.2.4): Loading from cache
- Installing symfony/yaml (v4.2.4): Loading from cache
Generating autoload files
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 255
!!
Script #auto-scripts was called via post-install-cmd
However, it works fine if I just use composer install without --no-dev
What can I do to make it work with --no-dev
Please refer to repository to access code if required.
apparently you have somehow managed to turn error display off (or it's some default). I get a very distinct error message when I run composer install --no-dev (run with commit e722218...)
!! PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "TwigBundle" from namespace "Symfony\Bundle\TwigBundle".
!! Did you forget a "use" statement for another namespace? in [path]/EresNoteSymfony/src/Kernel.php:23
!! Stack trace:
!! #0 [path]/EresNoteSymfony/vendor/symfony/http-kernel/Kernel.php(424): App\Kernel->registerBundles()
!! #1 [path]/EresNoteSymfony/vendor/symfony/http-kernel/Kernel.php(130): Symfony\Component\HttpKernel\Kernel->initializeBundles()
!! #2 [path]/EresNoteSymfony/vendor/symfony/framework-bundle/Console/Application.php(65): Symfony\Component\HttpKernel\Kernel->boot()
!! #3 [path]/EresNoteSymfony/vendor/symfony/console/Application.php(145): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
!! #4 [path]/EresNoteSymfony/bin/console(38): Symfony\Component\Console\Application->run(Object(Symfony\Componen in [path]/EresNoteSymfony/src/Kernel.php on line 23
!!
you should somehow turn error display on ;o)
update:
your config/bundles.php:6 says:
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
which essentially says, the twigbundle is expected in prod as well as in dev. thus the error? (but anyway, the point still stands, that you should display errors when running on cli)
after you change that line in your bundles.php, you have to move your twig.yaml config into the dev/test folders, I suppose.

Cannot Composer Install with Symfony - PhpStorm

I had a problem with my Ubuntu so I needed to install back everything.
Nearly all is done but when I start a new project with Symfony on PhpStorm, and when I do a composer install or composer update in the terminal I have an error that I don't know how to treat.
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the symfony-scripts event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command:
PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "DOMDocument" from the global namespace.
Did you forget a "use" statement? in /var/www/html/Eval2/vendor/symfony/symfony/src/Symfony/Component/Config/Util/XmlUtils.php:52
Stack trace:
#0 /var/www/html/Eval2/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php(284): Symfony\Component\Config\Util\XmlUtils::loadFile('/var/www/html/E...', Array)
#1 /var/www/html/Eval2/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php(41): Symfony\Component\DependencyInjection\Loader\XmlFileLoader->parseFileToDOM('/var/ww
w/html/E...')
#2 /var/www/html/Eval2/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php(57): Symfony\Component\DependencyInjection\Loader\XmlFileLoader->load('web.xm
l')
#3 /var/www/html/Eval2/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php in /var/www/html/Eval2/vendor/symfony/symfony/src/Symfony/Component/
Config/Util/XmlUtils.php on line 52
I tried installing composer following this link
but I don't recall using such practice.
So I cannot move forward with my project because I can't get past composer... if anyone knows why and could give me a step-by-step approach that would be truly appreciated.
Thank you
PHP's DOMDocument library is not installed. You need to install it. Try -
sudo apt-get install php-dom

PHP Fatal error when trying to install Cron in Laravel 4

I am trying to install Cron with laravel 4. I followed these instructions:
http://packalyst.com/packages/package/liebig/cron#addjob
However I got stuck when trying to migrate the database using command:
php artisan migrate --package="liebig/cron"
And this is the error:
PHP Fatal error: Class 'Liebig\Cron\CronServiceProvider' not found in /var/www/domain.com/htdocs/SP/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 157
{"error":{"type":"Symfony\Component\Debug\Exception\FatalErrorException","message":"Class 'Liebig\Cron\CronServiceProvider' not found","file":"/var/www/domain.com/htdocs/SP/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php","line":157}}
Yes, I have added Liebig\Cron\CronServiceProvider to providers in app.php
Any ideas? Thanks so much for your help.

Error in deploy my application Symfony [duplicate]

This question already has answers here:
Moving app to production mode in Symfony 2
(5 answers)
Closed 8 years ago.
I am trying to deploy my code on the server.
I followed these steps:
clear cache
update vendor
add configuration of my remote database
change the value of access cache and log
But I'm getting this error:
Fatal error: Uncaught exception 'Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException' with message 'You have requested a non-existent parameter "kernel.debug".' in /home/public_html/demo/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php:106
Stack trace: #0 /home/public_html/demo/app/bootstrap.php.cache(1959): Symfony\Component\DependencyInjection\ParameterBag\ParameterBag->get('kernel.debug')
#1 /home/public_html/demo/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php(85): Symfony\Component\DependencyInjection\Container->getParameter('kernel.debug')
#2 /home/public_html/demo/app/bootstrap.php.cache(2562): Symfony\Bundle\FrameworkBundle\FrameworkBundle->build(Object(Symfony\Component\DependencyInjection\ContainerBuilder))
#3 /home/public_html/demo/app/bootstrap.php.cache(2542): Symfony\Component\HttpKernel\Kernel->prepareContainer(Object(Symfony\Component\DependencyInjection\ContainerBuilde in /home/public_html/demo/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php on line 106
As you can see, this error is being thrown in bootstrap.php.cache.
Symfony uses a bootstrap file to improve class loading performance, as documented here. However, you presumably copied this file over from your development environment, and it hasn't yet been regenerated for production.
You will need to regenerate this file either by running composer install or by running the build script directly: php ./vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php

stange error with Behat and Mink on Sf2

I'm using Behat,mink in my Symfony2 project,so I follow those tutorials to make installation :
http://extensions.behat.org/symfony2/ , http://extensions.behat.org/symfony2/migrating_from_2.3_to_2.4.html
but when I run this command php behat.phar --init "#YouBundleName",I get this very strange error :
PHP Warning: require(Behat\MinkExtension\Extension): failed to open stream: No such file or directory in phar:///var/www/project/behat.phar/src/Behat/Behat /Extension/ExtensionManager.php on line 112
PHP Fatal error: require(): Failed opening required 'Behat\MinkExtension\Extension' (include_path='.:/usr/share/php:/usr/share/pear') in phar:///var/www/project/behat.phar/src/Behat/Behat/Extension/ExtensionManager.php on line 112
I'm sure I installed the last version of behat and mink mentionned in the second link above and then I made php composer.phar unpdate and cache clear too,but still the same error?
I had the same problem. Forgot you need to install behat/mink-extension as well as behat/mink. For example you might need to run:
php composer.phar require behat/mink-extension:*
Worked for me.
By the way, looks like you got confused by the two installation methods, phar vs composer. I'd go with the composer route because it's easier to update and manage versions. This would mean running php bin/behat ... instead of php behat.phar ....

Resources