Symfony "Unknown knp_menu_render function" on production - symfony

When transfering to production server I've got this error.
[2016-04-27 18:45:23] security.INFO: Populated the TokenStorage with an anonymous Token. [] []
[2016-04-27 18:45:24] request.CRITICAL: Uncaught PHP Exception Twig_Error_Syntax: "Unknown "knp_menu_render" function in "dailyShop/index.html.twig" at line 210." at /home/ashkov/www/ruproms.ru/vendor/twig/twig/lib/Twig/ExpressionParser.php line 573 {"exception":"[object] (Twig_Error_Syntax(code: 0): Unknown \"knp_menu_render\" function in \"dailyShop/index.html.twig\" at line 210. at /home/ashkov/www/ruproms.ru/vendor/twig/twig/lib/Twig/ExpressionParser.php:573)"} []
In the development enviroment everything is ok.
composer update was made several times.
new Knp\Bundle\MenuBundle\KnpMenuBundle(), on its place in app/AppKernel.php

This solved the problem:
php bin/console cache:clear -e prod

Related

Symfony 4.3 Warning: chdir(): No such file or directory (errno 2)

i try to add a new entity with the maker bundle of Symfony, but i can't get rid of this error , any help please :/ ?
it happen right after
php bin/console make:entity
Class name of the entity to create or update (e.g. GrumpyJellybean):
> Customer
Your entity already exists! So let's add some new fields!
PHP Fatal error: During class fetch: Uncaught ErrorException: Warning: chdir(): No such file or directory (errno......
Error: During class fetch: Uncaught ErrorException: Warning: chdir(): No such file or directory (errno 2) in
/Users/loic/Documents/TFE/cmi-3/vendor/symfony/debug/DebugClassLoader.php:458
Stack trace:
#0 phar:///Users/loic/Documents/TFE/cmi-3/vendor/phpstan/phpstan-shim/phpstan.phar/vendor/nikic/php-parser/l
ib/PhpParser/Lexer/Emulative.php(12): spl_autoload_call('PhpParser\\Lexer')
#1 /Users/loic/Documents/TFE/cmi-3/vendor/symfony/maker-bundle/src/Util/ClassSourceManipulator.php(63): spl_
autoload_call('PhpParser\\Lexer...')
#2 /Users/loic/Documents/TFE/cmi-3/vendor/symfony/maker-bundle/src/Maker/MakeEntity.php(743): Symfony\Bundle
\MakerBundle\Util\ClassSourceManipulator->__construct('<?php\n\nnamespac...', false)
#3 /Users/loic/Documents/TFE/cmi-3/vendor/symfony/maker-bundle/src/Maker/MakeEntity.php(167): Symfony\Bundle
\MakerBundle\Maker\MakeEntity->createClassManipulator('/Users/loic/Doc...', Object(Symfony\Bundle\MakerBundl
e\ConsoleStyle), false)
For now i got it working with
php bin/console make:entity --no-debug
it'll do the job but i still don't know what is happening.

How to fix error: "Call to a member function listSpatialIndexes() on null" and why is it happening?

I have command:
php bin/console doctrine:schema:validate -e prod
When I run it, I'm getting error
"Call to a member function listSpatialIndexes() on null".
Please, help me by explain why it happens and how to fix it.
Additionally, the command "php bin/console doctrine:schema:validate -e dev", ends with the error
"[ERROR] The database schema is not in sync with the current mapping
file."
The problem was that variable server_version in pgsql in doctrine.yaml didn't exist. To resolve the problem, add
pgsql:
...
server_version: <insert your server version here, in my case 11.3>
You can see server's version by adding echo($this->getServerVersion()) and then exit(1) in the line 452 in vendor's file vendor\doctrine\dbal\lib\Doctrine\DBAL\Connection.php.

Error 500 after composer update in symfony 3

i try to clone my project into my computer.
I had clone the repository and done "composer update". All without any errors.
when i try to visit my site show this error
Call to a member function has() on null
500 Internal Server Error - FatalThrowableError
and the debug
CRITICAL - Call to a member function has() on null
CRITICAL - Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Call to a member function has() on null" at C:\xampp\htdocs\richiesta_analisi\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Controller\Controller.php line 234
is the same repository that i had in remote so i don't understand why don't work.
i tryed to clear cache and composer upgrade but nothing.
Can you help me?

symfony2.7 FOS USER error on prod

I just try to connect on my website using the app.php with
new AppKernel('prod', false);
and i got an error 500 when login and stay blocked on /login_check.
But if i change it to:
new AppKernel('prod', true);
its work with no problem!!
So i check the prod.log of symfony and here what i found:
[2015-06-24 13:47:11] php.CRITICAL: Fatal Compile Error: require(): Failed opening required '/var/www/html/crm/app/cache/prod/doctrine/orm/Proxies/__CG__dmMembreBundleEntityMembreAuth.php' (include_path='.:/usr/share/pear:/usr/share/php') {"type":64,"file":"/var/www/html/crm/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php","line":209,"level":6143,"stack":[{"function":"getProxyDefinition","type":"->","class":"Doctrine\\Common\\Proxy\\AbstractProxyFactory","file":"/var/www/html/crm/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php","line":119,"args":[]},{"function":"getProxy","type":"->","class":"Doctrine\\Common\\Proxy\\AbstractProxyFactory","file":"/var/www/html/crm/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php","line":2677,"args":[]},{"function":"createEntity","type":"->","class":"Doctrine\\ORM\\UnitOfWork","file":"/var/www/html/crm/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php","line":138,"args":[]},{"function":"hydrateRowData","type":"->","class":"Doctrine\\ORM\\Internal\\Hydration\\SimpleObjectHydrator","file":"/var/www/html/crm/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php","line":48,"args":[]},{"function":"hydrateAllData","type":"->","class":"Doctrine\\ORM\\Internal\\Hydration\\SimpleObjectHydrator","file":"/var/www/html/crm/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php","line":140,"args":[]},{"function":"hydrateAll","type":"->","class":"Doctrine\\ORM\\Internal\\Hydration\\AbstractHydrator","file":"/var/www/html/crm/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php","line":756,"args":[]},{"function":"load","type":"->","class":"Doctrine\\ORM\\Persisters\\BasicEntityPersister","file":"/var/www/html/crm/vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php","line":196,"args":[]},{"function":"findOneBy","type":"->","class":"Doctrine\\ORM\\EntityRepository","file":"/var/www/html/crm/vendor/friendsofsymfony/user-bundle/Doctrine/UserManager.php","line":68,"args":[]},{"function":"findUserBy","type":"->","class":"FOS\\UserBundle\\Doctrine\\UserManager","file":"/var/www/html/crm/vendor/friendsofsymfony/user-bundle/Model/UserManager.php","line":92,"args":[]},{"function":"findUserByUsername","type":"->","class":"FOS\\UserBundle\\Model\\UserManager","file":"/var/www/html/crm/vendor/friendsofsymfony/user-bundle/Model/UserManager.php","line":108,"args":[]},{"function":"findUserByUsernameOrEmail","type":"->","class":"FOS\\UserBundle\\Model\\UserManager","file":"/var/www/html/crm/vendor/friendsofsymfony/user-bundle/Security/EmailUserProvider.php","line":21,"args":[]},{"function":"findUser","type":"->","class":"FOS\\UserBundle\\Security\\EmailUserProvider","file":"/var/www/html/crm/vendor/friendsofsymfony/user-bundle/Security/UserProvider.php","line":45,"args":[]},{"function":"loadUserByUsername","type":"->","class":"FOS\\UserBundle\\Security\\UserProvider","file":"/var/www/html/crm/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/Provider/DaoAuthenticationProvider.php","line":83,"args":[]},{"function":"retrieveUser","type":"->","class":"Symfony\\Component\\Security\\Core\\Authentication\\Provider\\DaoAuthenticationProvider","file":"/var/www/html/crm/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/Provider/UserAuthenticationProvider.php","line":70,"args":[]},{"function":"authenticate","type":"->","class":"Symfony\\Component\\Security\\Core\\Authentication\\Provider\\UserAuthenticationProvider","file":"/var/www/html/crm/app/cache/prod/classes.php","line":3077,"args":[]},{"function":"authenticate","type":"->","class":"Symfony\\Component\\Security\\Core\\Authentication\\AuthenticationProviderManager","file":"/var/www/html/crm/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/UsernamePasswordFormAuthenticationListener.php","line":96,"args":[]},{"function":"attemptAuthentication","type":"->","class":"Symfony\\Component\\Security\\Http\\Firewall\\UsernamePasswordFormAuthenticationListener","file":"/var/www/html/crm/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php","line":146,"args":[]},{"function":"handle","type":"->","class":"Symfony\\Component\\Security\\Http\\Firewall\\AbstractAuthenticationListener","file":"/var/www/html/crm/app/cache/prod/classes.php","line":2992,"args":[]},{"function":"onKernelRequest","type":"->","class":"Symfony\\Component\\Security\\Http\\Firewall","file":"/var/www/html/crm/app/cache/prod/classes.php","line":2245,"args":[]},{"function":"call_user_func:{/var/www/html/crm/app/cache/prod/classes.php:2245}","file":"/var/www/html/crm/app/cache/prod/classes.php","line":2245,"args":[]},{"function":"doDispatch","type":"->","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","file":"/var/www/html/crm/app/cache/prod/classes.php","line":2178,"args":[]},{"function":"dispatch","type":"->","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","file":"/var/www/html/crm/app/cache/prod/classes.php","line":2339,"args":[]},{"function":"dispatch","type":"->","class":"Symfony\\Component\\EventDispatcher\\ContainerAwareEventDispatcher","file":"/var/www/html/crm/app/bootstrap.php.cache","line":3083,"args":[]},{"function":"handleRaw","type":"->","class":"Symfony\\Component\\HttpKernel\\HttpKernel","file":"/var/www/html/crm/app/bootstrap.php.cache","line":3056,"args":[]},{"function":"handle","type":"->","class":"Symfony\\Component\\HttpKernel\\HttpKernel","file":"/var/www/html/crm/app/bootstrap.php.cache","line":3207,"args":[]},{"function":"handle","type":"->","class":"Symfony\\Component\\HttpKernel\\DependencyInjection\\ContainerAwareHttpKernel","file":"/var/www/html/crm/app/bootstrap.php.cache","line":2429,"args":[]},{"function":"handle","type":"->","class":"Symfony\\Component\\HttpKernel\\Kernel","file":"/var/www/html/crm/web/app.php","line":28,"args":[]},{"function":"{main}","file":"/var/www/html/crm/web/app.php","line":0,"args":[]}]} []
[2015-06-24 13:47:11] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalErrorException: "Compile Error: require(): Failed opening required '/var/www/html/crm/app/cache/prod/doctrine/orm/Proxies/__CG__dmMembreBundleEntityMembreAuth.php' (include_path='.:/usr/share/pear:/usr/share/php')" at /var/www/html/crm/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php line 209 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalErrorException(code: 0): Compile Error: require(): Failed opening required '/var/www/html/crm/app/cache/prod/doctrine/orm/Proxies/__CG__dmMembreBundleEntityMembreAuth.php' (include_path='.:/usr/share/pear:/usr/share/php') at /var/www/html/crm/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php:209)"} []
Off course i first think about chmod on my cache directory but evrything is on 777 recursivly... and working like a charm if i dont set the debug on false!
So if anyone have an idea...
Found the answer
Before go on prod, we need to warm the prod cache to completely delete so before delete of the cache folder we have to execute this command:
php app/console cache:warmup --env=prod --no-debug
and after:
rm -rf app/cache/*; chmod -R 777 app/cache
And that's all folks!

Symfony2 prod environment, swiftmailer log

I am having problems when I use my Symfony2 project in prod environment. I am getting this log... anyone could help me? In dev environment, everything is ok...
[2014-06-29 20:12:24] request.CRITICAL: Uncaught PHP Exception
Twig_Error_Syntax: "An exception has been thrown during the
compilation of a template ("There is no "yui_js" filter.") in
"AvocodeFormExtensionsBundle::javascripts.html.twig"." at
C:\xampp\htdocs\UniDocs\vendor\twig\twig\lib\Twig\Environment.php line
564 {"exception":"[object] (Twig_Error_Syntax: An exception has been
thrown during the compilation of a template (\"There is no \"yui_js\"
filter.\") in \"AvocodeFormExtensionsBundle::javascripts.html.twig\".
at
C:\xampp\htdocs\UniDocs\vendor\twig\twig\lib\Twig\Environment.php:564,
InvalidArgumentException: There is no \"yui_js\" filter. at
C:\xampp\htdocs\UniDocs\vendor\kriswallsmith\assetic\src\Assetic\FilterManager.php:35)"}
[]

Resources