Error 500 on Fresh install

Questions around the Aimeos bundle for the Symfony framework
Forum rules
Always add your Symfony, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Doveman
Posts: 23
Joined: 06 Nov 2017, 20:59

Error 500 on Fresh install

Post by Doveman » 26 Nov 2017, 04:41

I installed symfony 3.3.13 and aimeos 2017.10 on my public server in dev mode. It installed just fine and everything looks good. When I try to execute app_dev.php/list I get a debug page which show in the Apache log as a 500 error.

I have absolutly no idea where to go with this. Any ideas?

There are actually 3 parts to the debug page.

Part 3:
(3/3) Twig_Error_Syntax
An exception has been thrown during the compilation of a template ("Catchable Fatal Error: Argument 1 passed to Twig_Filter::__construct() must be an instance of string, string given, called in /var/www/www.3wings.com/htdocs/zlcsymfony/vendor ... n/Core.php on line 139 and defined") in "@Twig/Exception/exception_full.html.twig".

Part 2:
(2/3) ContextErrorException
Catchable Fatal Error: Argument 1 passed to Twig_Filter::__construct() must be an instance of string, string given, called in /var/www/www.3wings.com/htdocs/zlcsymfony/vendor ... n/Core.php on line 139 and defined

Part 1:
(1/3) ContextErrorException
Catchable Fatal Error: Argument 1 passed to Twig_Function::__construct() must be an instance of string, string given, called in /var/www/www.3wings.com/htdocs/zlcsymfony/vendor ... e/View.php on line 306 and defined

User avatar
aimeos
Administrator
Posts: 7858
Joined: 01 Jan 1970, 00:00

Re: Error 500 on Fresh install

Post by aimeos » 26 Nov 2017, 23:51

If it's only on the live server, maybe the PHP version isn't compatible. Also, perhaps installation of the composer packages was not 100% correct.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Doveman
Posts: 23
Joined: 06 Nov 2017, 20:59

Re: Error 500 on Fresh install

Post by Doveman » 27 Nov 2017, 18:18

I verified the php version and configuration, updated the composer and then did a clean install from scratch. I then modified the necessary config files and installed Aimeos.
I also checked the Apache config to make sure all was correct.
After all that I still am getting the failure.
I have included the dev.log below from a single try.
Could you take a look and see if you can tell what is wrong?
Thanks

Code: Select all

[2017-11-27 09:49:04] request.INFO: Matched route "aimeos_shop_list". {"route":"aimeos_shop_list","route_parameters":{"_controller":"Aimeos\\ShopBundle\\Controller\\CatalogController::listAction","f_catid":null,"f_name":"","_route":"aimeos_shop_list"},"request_uri":"http://3wings.com/zlcsymfony/web/app_dev.php/list","method":"GET"} []
[2017-11-27 09:49:04] security.INFO: Populated the TokenStorage with an anonymous Token. [] []
[2017-11-27 09:49:04] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\ContextErrorException: "Catchable Fatal Error: Argument 1 passed to Twig_Function::__construct() must be an instance of string, string given, called in /var/www/www.3wings.com/htdocs/zlcsymfony/vendor/aimeos/aimeos-symfony/Service/View.php on line 306 and defined" at /var/www/www.3wings.com/htdocs/zlcsymfony/vendor/twig/twig/lib/Twig/Function.php line 35 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\ContextErrorException(code: 0): Catchable Fatal Error: Argument 1 passed to Twig_Function::__construct() must be an instance of string, string given, called in /var/www/www.3wings.com/htdocs/zlcsymfony/vendor/aimeos/aimeos-symfony/Service/View.php on line 306 and defined at /var/www/www.3wings.com/htdocs/zlcsymfony/vendor/twig/twig/lib/Twig/Function.php:35)"} []
[2017-11-27 09:49:04] request.CRITICAL: Exception thrown when handling an exception (Twig_Error_Syntax: An exception has been thrown during the compilation of a template ("Catchable Fatal Error: Argument 1 passed to Twig_Filter::__construct() must be an instance of string, string given, called in /var/www/www.3wings.com/htdocs/zlcsymfony/vendor/twig/twig/lib/Twig/Extension/Core.php on line 139 and defined") in "@Twig/Exception/exception_full.html.twig". at /var/www/www.3wings.com/htdocs/zlcsymfony/vendor/twig/twig/lib/Twig/Environment.php line 566) {"exception":"[object] (Twig_Error_Syntax(code: 0): An exception has been thrown during the compilation of a template (\"Catchable Fatal Error: Argument 1 passed to Twig_Filter::__construct() must be an instance of string, string given, called in /var/www/www.3wings.com/htdocs/zlcsymfony/vendor/twig/twig/lib/Twig/Extension/Core.php on line 139 and defined\") in \"@Twig/Exception/exception_full.html.twig\". at /var/www/www.3wings.com/htdocs/zlcsymfony/vendor/twig/twig/lib/Twig/Environment.php:566, Symfony\\Component\\Debug\\Exception\\ContextErrorException(code: 0): Catchable Fatal Error: Argument 1 passed to Twig_Filter::__construct() must be an instance of string, string given, called in /var/www/www.3wings.com/htdocs/zlcsymfony/vendor/twig/twig/lib/Twig/Extension/Core.php on line 139 and defined at /var/www/www.3wings.com/htdocs/zlcsymfony/vendor/twig/twig/lib/Twig/Filter.php:35)"} []
[2017-11-27 09:49:04] php.CRITICAL: Uncaught Exception: An exception has been thrown during the compilation of a template ("Catchable Fatal Error: Argument 1 passed to Twig_Filter::__construct() must be an instance of string, string given, called in /var/www/www.3wings.com/htdocs/zlcsymfony/vendor/twig/twig/lib/Twig/Extension/Core.php on line 139 and defined") in "@Twig/Exception/exception_full.html.twig". {"exception":"[object] (Twig_Error_Syntax(code: 0): An exception has been thrown during the compilation of a template (\"Catchable Fatal Error: Argument 1 passed to Twig_Filter::__construct() must be an instance of string, string given, called in /var/www/www.3wings.com/htdocs/zlcsymfony/vendor/twig/twig/lib/Twig/Extension/Core.php on line 139 and defined\") in \"@Twig/Exception/exception_full.html.twig\". at /var/www/www.3wings.com/htdocs/zlcsymfony/vendor/twig/twig/lib/Twig/Environment.php:566, Symfony\\Component\\Debug\\Exception\\ContextErrorException(code: 0): Catchable Fatal Error: Argument 1 passed to Twig_Filter::__construct() must be an instance of string, string given, called in /var/www/www.3wings.com/htdocs/zlcsymfony/vendor/twig/twig/lib/Twig/Extension/Core.php on line 139 and defined at /var/www/www.3wings.com/htdocs/zlcsymfony/vendor/twig/twig/lib/Twig/Filter.php:35, Symfony\\Component\\Debug\\Exception\\ContextErrorException(code: 0): Catchable Fatal Error: Argument 1 passed to Twig_Function::__construct() must be an instance of string, string given, called in /var/www/www.3wings.com/htdocs/zlcsymfony/vendor/aimeos/aimeos-symfony/Service/View.php on line 306 and defined at /var/www/www.3wings.com/htdocs/zlcsymfony/vendor/twig/twig/lib/Twig/Function.php:35)"} []
[2017-11-27 09:49:04] request.CRITICAL: Uncaught PHP Exception Twig_Error_Syntax: "An exception has been thrown during the compilation of a template ("Catchable Fatal Error: Argument 1 passed to Twig_Filter::__construct() must be an instance of string, string given, called in /var/www/www.3wings.com/htdocs/zlcsymfony/vendor/twig/twig/lib/Twig/Extension/Core.php on line 139 and defined") in "@Twig/Exception/exception_full.html.twig"." at /var/www/www.3wings.com/htdocs/zlcsymfony/vendor/twig/twig/lib/Twig/Environment.php line 566 {"exception":"[object] (Twig_Error_Syntax(code: 0): An exception has been thrown during the compilation of a template (\"Catchable Fatal Error: Argument 1 passed to Twig_Filter::__construct() must be an instance of string, string given, called in /var/www/www.3wings.com/htdocs/zlcsymfony/vendor/twig/twig/lib/Twig/Extension/Core.php on line 139 and defined\") in \"@Twig/Exception/exception_full.html.twig\". at /var/www/www.3wings.com/htdocs/zlcsymfony/vendor/twig/twig/lib/Twig/Environment.php:566, Symfony\\Component\\Debug\\Exception\\ContextErrorException(code: 0): Catchable Fatal Error: Argument 1 passed to Twig_Filter::__construct() must be an instance of string, string given, called in /var/www/www.3wings.com/htdocs/zlcsymfony/vendor/twig/twig/lib/Twig/Extension/Core.php on line 139 and defined at /var/www/www.3wings.com/htdocs/zlcsymfony/vendor/twig/twig/lib/Twig/Filter.php:35, Symfony\\Component\\Debug\\Exception\\ContextErrorException(code: 0): Catchable Fatal Error: Argument 1 passed to Twig_Function::__construct() must be an instance of string, string given, called in /var/www/www.3wings.com/htdocs/zlcsymfony/vendor/aimeos/aimeos-symfony/Service/View.php on line 306 and defined at /var/www/www.3wings.com/htdocs/zlcsymfony/vendor/twig/twig/lib/Twig/Function.php:35)"} []
[2017-11-27 09:49:04] request.CRITICAL: Exception thrown when handling an exception (Twig_Error_Syntax: An exception has been thrown during the compilation of a template ("Catchable Fatal Error: Argument 1 passed to Twig_Filter::__construct() must be an instance of string, string given, called in /var/www/www.3wings.com/htdocs/zlcsymfony/vendor/twig/twig/lib/Twig/Extension/Core.php on line 139 and defined") in "@Twig/Exception/exception_full.html.twig". at /var/www/www.3wings.com/htdocs/zlcsymfony/vendor/twig/twig/lib/Twig/Environment.php line 566) {"exception":"[object] (Twig_Error_Syntax(code: 0): An exception has been thrown during the compilation of a template (\"Catchable Fatal Error: Argument 1 passed to Twig_Filter::__construct() must be an instance of string, string given, called in /var/www/www.3wings.com/htdocs/zlcsymfony/vendor/twig/twig/lib/Twig/Extension/Core.php on line 139 and defined\") in \"@Twig/Exception/exception_full.html.twig\". at /var/www/www.3wings.com/htdocs/zlcsymfony/vendor/twig/twig/lib/Twig/Environment.php:566, Symfony\\Component\\Debug\\Exception\\ContextErrorException(code: 0): Catchable Fatal Error: Argument 1 passed to Twig_Filter::__construct() must be an instance of string, string given, called in /var/www/www.3wings.com/htdocs/zlcsymfony/vendor/twig/twig/lib/Twig/Extension/Core.php on line 139 and defined at /var/www/www.3wings.com/htdocs/zlcsymfony/vendor/twig/twig/lib/Twig/Filter.php:35)"} []

User avatar
aimeos
Administrator
Posts: 7858
Joined: 01 Jan 1970, 00:00

Re: Error 500 on Fresh install

Post by aimeos » 27 Nov 2017, 21:55

According to this post, the PHP 7.x is required for Twig 2.x:
https://stackoverflow.com/questions/418 ... f-string-s
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Doveman
Posts: 23
Joined: 06 Nov 2017, 20:59

Re: Error 500 on Fresh install

Post by Doveman » 28 Nov 2017, 16:05

So as far as I can figure out Symfony has started installing twig 2.x with version 3.3.13 so I created a new project with version 3.3.11 which did install twig 1.x but when I then installed Aimeos it overwrote the 1.x with 2.x. My final solution (until I can upgrade to linux 9 with php 7) was to overwrite the twig 2.x version on the public server with the twig 1.x version from my dev machine. It is definitely not the best solution but for the time being it does work.

Thanks for your help.

User avatar
aimeos
Administrator
Posts: 7858
Joined: 01 Jan 1970, 00:00

Re: Error 500 on Fresh install

Post by aimeos » 28 Nov 2017, 22:00

A clean way is to add this to the require section in your composer.json to enforce Twig 1.x:

Code: Select all

"twig/twig": "~1.34"
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply