Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Unable to load class "Twig_Extension_Escaper"' - symfony

I have this error in my system in the production server, but I have no idea why cause in my development server everything run fine.
Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Unable to load class "Twig_Extension_Escaper"' in /home/content/79/11253479/html/witf/path/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php:259 Stack trace: #0 /home/content/79/11253479/html/witf/path/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php(98): Symfony\Component\ClassLoader\ClassCollectionLoader::getOrderedClasses(Array) #1 /home/content/79/11253479/html/witf/path/app/bootstrap.php.cache(2303): Symfony\Component\ClassLoader\ClassCollectionLoader::load(Array, '/home/content/7...', 'classes', false, false, '.php') #2 /home/content/79/11253479/html/witf/path/app/bootstrap.php.cache(2139): Symfony\Component\HttpKernel\Kernel->doLoadClassCache('classes', '.php') #3 /home/content/79/11253479/html/witf/path/app/bootstrap.php.cache(2173): Symfony\Component\HttpKernel\Kernel->boot() #4 /home/content/79/11253479/html/index.php(27): Symfony\Component\HttpKernel\Kernel->handle(Object(S in /home/content/79/11253479/html/witf/path/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php on line 259

please try composer update -o and afterwards app/console cache:clear --env=prod.
Further check that the file vendor/twig/twig/lib/Twig/Extension/Escaper.php actually exists on your production server.

Related

Fatal error: Uncaught Twig\Error\LoaderError

I have just deployed my application on the server. If I use APP_ENV=dev, everything works fine but if I use APP_ENV=prod, I get the following error:
Fatal error: Uncaught Twig\Error\LoaderError: The
"/home/httpd/vhosts/example.com/httpdocs/api_tapalle\vendor\symfony\framework-bundle/Resources/views"
directory does not exist
("/home/httpd/vhosts/example.com/httpdocs/api_tapalle\vendor\symfony\framework-bundle/Resources/views").
in
/home/httpd/vhosts/example.com/httpdocs/api_tapalle/vendor/twig/twig/src/Loader/FilesystemLoader.php:106
Stack trace: #0
/home/httpd/vhosts/example.com/httpdocs/api_tapalle/var/cache/prod/ContainerTP5linE/srcApp_KernelProdContainer.php(471):
Twig\Loader\FilesystemLoader->addPath('/home/httpd/vho...',
'Framework') #1
/home/httpd/vhosts/example.com/httpdocs/api_tapalle/var/cache/prod/ContainerTP5linE/srcApp_KernelProdContainer.php(729):
ContainerTP5linE\srcApp_KernelProdContainer->getTwigService() #2
/home/httpd/vhosts/example.com/httpdocs/api_tapalle/var/cache/prod/ContainerTP5linE/srcApp_KernelProdContainer.php(346):
ContainerTP5linE\srcApp_KernelProdContainer->getSensioFrameworkExtra_View_ListenerService() #3 /home/httpd/vhosts/y in /home/httpd/vhosts/example.com/httpdocs/api_tapalle/vendor/twig/twig/src/Loader/FilesystemLoader.php
on line 106
Since I have this error, I have used php bin/console cache:clear -e prod to clear the cache and then uploaded var and vendor directories again.
The weird thing is that vendor\symfony\framework-bundle/Resources/views and vendor/twig/twig/src/Loader/FilesystemLoader.php exist on the server!
Why do I get this error?
updlas the project with all the cache production, dont make a cache clear

How to fix WordPress kses error and fatal error handler

I'm new at making website. Even I only know Html Coding. I'm running a website using WordPress, but it is facing problem everyday at same time. Everyday at the same time site is showing Http 500 error.
So as I don't know any kind of coding, every day I have to delete WordPress from my site then again have to install it then I have to restore website using Updraftplus. But I want to fix this oroblem.
I have an option in my cPanel called "Errors". I find this error from there.
I copied what there was said:
1st error:
[Mon Dec 23 03:46:44.895719 2019] [lsapi:error] [pid 1014092:tid 47766993704704] [client 141.8.188.1:46957] [host gokumovie.com] Backend fatal error: PHP Fatal error: Uncaught Error: Call to undefined function esc_url() in /home/gokumovi/public_html/wp-includes/class-wp-fatal-error-handler.php:190\nStack trace:\n#0 /home/gokumovi/public_html/wp-includes/class-wp-fatal-error-handler.php(147): WP_Fatal_Error_Handler->display_default_error_template(Array, false)\n#1 /home/gokumovi/public_html/wp-includes/class-wp-fatal-error-handler.php(52): WP_Fatal_Error_Handler->display_error_template(Array, false)\n#2 [internal function]: WP_Fatal_Error_Handler->handle()\n#3 {main}\n thrown in /home/gokumovi/public_html/wp-includes/class-wp-fatal-error-handler.php on line 190\n
2nd error :
Backend fatal error: PHP Fatal error: Uncaught Error: Call to undefined function wp_kses_normalize_entities() in /home/gokumovi/public_html/wp-includes/formatting.php:4316\nStack trace:\n#0 /home/gokumovi/public_html/wp-includes/class-wp-fatal-error-handler.php(190): esc_url('https://wordpre...')\n#1 /home/gokumovi/public_html/wp-includes/class-wp-fatal-error-handler.php(147): WP_Fatal_Error_Handler->display_default_error_template(Array, false)\n#2 /home/gokumovi/public_html/wp-includes/class-wp-fatal-error-handler.php(52): WP_Fatal_Error_Handler->display_error_template(Array, false)\n#3 [internal function]: WP_Fatal_Error_Handler->handle()\n#4 {main}\n thrown in /home/gokumovi/public_html/wp-includes/formatting.php on line 4316\n

Uncaught exception 'RuntimeException' with message 'Unable to write in the cache directory

When I try do deploy my website on the server I have this error :
Fatal error: Uncaught exception 'RuntimeException' with message 'Unable to write in the cache directory (/home/e120223/public_html/ReclyZone/app/cache/prod) ' in /home/e120223/public_html/ReclyZone/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:597 Stack trace: #0 /home/e120223/public_html/ReclyZone/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(510): Symfony\Component\HttpKernel\Kernel->buildContainer() #1 /home/e120223/public_html/ReclyZone/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(133): Symfony\Component\HttpKernel\Kernel->initializeContainer() #2 /home/e120223/public_html/ReclyZone/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(182): Symfony\Component\HttpKernel\Kernel->boot() #3 /home/e120223/public_html/ReclyZone/web/app.php(16): Symfony\Component\HttpKernel\Kernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #4 {main} thrown in /home/e120223/public_html/ReclyZone/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php on line 597
I have already clear cache but nothing works, do you have an idea ?
chmod -R 777on the cache directory to give permission to read AND write
The problem is that you don't have permission to write in that cache directory.
I would change the default cache directory to a writable folder.
See the official documentation http://symfony.com/doc/current/configuration/override_dir_structure.html#override-cache-dir

Symfony2 error when deploying

I'm new with symfony. I get this error when launch project after deploying.
Could u help me please.
Thanks
Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Service "fragment.renderer.inline" must implement interface "Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface".' in /htdocs/DEV-web/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/FragmentRendererPass.php:58 Stack trace: #0 /htdocs/DEV-web/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php(107): Symfony\Component\HttpKernel\DependencyInjection\FragmentRendererPass->process(Object(Symfony\Component\DependencyInjection\ContainerBuilder)) #1 /htdocs/DEV-web/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php(593): Symfony\Component\DependencyInjection\Compiler\Compiler->compile(Object(Symfony\Component\DependencyInjection\ContainerBuilder)) #2 /htdocs/DEV-web/app/bootstrap.php.cache(2698): Symfony\Component\DependencyInjection\ContainerBuilder->compile() #3 /htdocs/DEV-web/app/bootstrap.php.cache(2476): Symfony\Component\HttpKernel\Kernel->in in /htdocs/DEV-web/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/FragmentRendererPass.php on line 58

Fatal error: Uncaught exception 'ReflectionException' with message 'Class Cl\CommonBundle\Entity\integer does not exist

I have developed application in symfony2.3, it's working perfect in development environment but while I move to production it throws error. I tried but it can't resolve.
Following all error comes form different page :
This error comes while I tried to access my home page.
Fatal error: Uncaught exception 'ReflectionException' with message 'Class Cl\CommonBundle\Entity\integer does not exist' in /opt/lampp/htdocs/Cl/vendor/doctrine/common/lib/Doctrine/Common/Proxy/ProxyGenerator.php:795 Stack trace: #0 /opt/lampp/htdocs/Cl/vendor/doctrine/common/lib/Doctrine/Common/Proxy/ProxyGenerator.php(795): ReflectionParameter->getClass() #1 [internal function]: Doctrine\Common\Proxy\ProxyGenerator->generateMethods(Object(Doctrine\ORM\Mapping\ClassMetadata)) #2 /opt/lampp/htdocs/Cl/vendor/doctrine/common/lib/Doctrine/Common/Proxy/ProxyGenerator.php(276): call_user_func(Array, Object(Doctrine\ORM\Mapping\ClassMetadata)) #3 /opt/lampp/htdocs/Cl/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php(155): Doctrine\Common\Proxy\ProxyGenerator->generateProxyClass(Object(Doctrine\ORM\Mapping\ClassMetadata), '/opt/lampp/htdo...') #4 /opt/lampp/htdocs/Cl/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/CacheWarmer/ProxyCacheWarmer.php(71 in /opt/lampp/htdocs/Cl/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/UnexpectedValueException.php on line 51
When I clear cache of production environment in command line, it throws following exception :
[Doctrine\Common\Proxy\Exception\UnexpectedValueException]
The type hint of parameter "user" in method "setUser" in class "Cl\CommonBundle\Entity\GroupEventComment" is invalid.
[ReflectionException]
Class Collegelife\CommonBundle\Entity\integer does not exist
Once this has been solved then it throws to other class, so I can't understand that what's happen.
When I tried to login into page :
it shows me error like :
Fatal error: require(): Failed opening required '/opt/lampp/htdocs/collegelife/app/cache/prod/doctrine/orm/Proxies/__CG__CollegelifeCommonBundleEntityUniversity.php' (include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/collegelife/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php on line 207
I had the same question and resolved it.
Because My Entity's setting.
You can't type hint on a scalar type (integer/string/boolean etc) in PHP. e.g.
public function setSortOrder(\integer $sortOrder)
Should be:
public function setSortOrder($sortOrder)

Resources