Answers.Body: <p>Your deployment process is not installing PHP dependencies, including the updated version of Craft. Normally I'd expect a deployment script to include something like:</p>
  <pre><code>composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader
  </code></pre>
  <p>That should run first, to update Craft and its dependencies, before you begin running Craft commands.</p>
  <p>Additionally, you could run just <code>php craft up</code> to apply both migrations and project config changes, per: <a href="https://craftcms.com/docs/3.x/console-commands.html#up-index" rel="nofollow noreferrer">https://craftcms.com/docs/3.x/console-commands.html#up-index</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-08-22T08:34:09.873Z
Answers.Text: The platform file is configured to run composer install first. Running php craft up reports there are no new migrations or config changes.
Answers.UserDisplayName: Geordi Feijens
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-08-23T11:53:37.777Z
Answers.Text: try `rm -rf ./vendor && composer i --no-scripts && php craft migrate/all && php craft project-config/apply && php craft clear-caches/all`
Answers.UserDisplayName: Leo Leoncio
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-08-22T08:26:39.733Z
Answers.LastActivityDate: 2024-08-22T08:26:39.733Z
Answers.UserDisplayName: Seth Warburton
Answers.Body: <p>A few versions:
  Is PHP version &gt;= 8.2?
  And do you have/use an .env file? If so, check that it present after upgrading to Craft 5.x.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-08-30T22:20:30.930Z
Answers.LastActivityDate: 2024-08-30T22:20:30.930Z
Answers.UserDisplayName: RomanAvr
Body: <p>After following the required steps for the craft 5 upgrade, performing the update itself works locally.</p>
  <p>When I tried pushing it to the test server, which already had the neccessary work done to make the update go smoothly (updating plugins to latest versions, migrating typed link field and redactor, ...). Every page on the site (including admin pages) displays an &quot;Internal server error&quot;.</p>
  <p>Following commands are fired when pushing to the server:</p>
  <ul>
  <li>php craft clear-caches/all</li>
  <li>php craft migrate/all</li>
  <li>php craft project-config/apply</li>
  <li>php craft clear-caches/all</li>
  </ul>
  <p>The server requirements seem to be correct so I don't really know what is going wrong here.</p>
  <p>The following errors are added to the log files:</p>
  <p><strong>web.log (on every page refresh)</strong></p>
  <pre><code>2024-08-21 06:24:35 [web.ERROR] [yii\base\InvalidArgumentException] Syntax error {&quot;trace&quot;:[
  &quot;#0 /var/www/html/vendor/yiisoft/yii2/helpers/BaseJson.php(128): yii\\helpers\\BaseJson::handleJsonError()&quot;,
  &quot;#1 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(2246): yii\\helpers\\BaseJson::decode()&quot;,
  &quot;#2 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(3460): craft\\elements\\db\\ElementQuery-&gt;createElement()&quot;,
  &quot;#3 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1708): craft\\elements\\db\\ElementQuery-&gt;_createElements()&quot;,
  &quot;#4 /var/www/html/vendor/yiisoft/yii2/db/Query.php(251): craft\\elements\\db\\ElementQuery-&gt;populate()&quot;,
  &quot;#5 /var/www/html/vendor/craftcms/cms/src/db/Query.php(292): yii\\db\\Query-&gt;all()&quot;,
  &quot;#6 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1781): craft\\db\\Query-&gt;all()&quot;,
  &quot;#7 /var/www/html/vendor/craftcms/cms/src/services/Globals.php(556): craft\\elements\\db\\ElementQuery-&gt;all()&quot;,
  &quot;#8 /var/www/html/vendor/craftcms/cms/src/services/Globals.php(151): craft\\services\\Globals-&gt;_allSets()&quot;,
  &quot;#9 /var/www/html/vendor/craftcms/cms/src/web/twig/variables/Cp.php(230): craft\\services\\Globals-&gt;getEditableSets()&quot;,
  &quot;#10 /var/www/html/vendor/twig/twig/src/Extension/CoreExtension.php(1635): craft\\web\\twig\\variables\\Cp-&gt;nav()&quot;,
  &quot;#11 /var/www/html/vendor/craftcms/cms/src/helpers/Template.php(148): twig_get_attribute()&quot;,
  &quot;#12 /var/www/html/storage/runtime/compiled_templates/09/0962a246cc38eb3f42320868c2e3c859.php(64): craft\\helpers\\Template::attribute()&quot;,
  &quot;#13 /var/www/html/vendor/twig/twig/src/Template.php(394): __TwigTemplate_4f43f22952f90733d4ba4874a2109b15-&gt;doDisplay()&quot;,
  &quot;#14 /var/www/html/vendor/twig/twig/src/Template.php(367): Twig\\Template-&gt;displayWithErrorHandling()&quot;,
  &quot;#15 /var/www/html/storage/runtime/compiled_templates/70/70646a7828221a1e0cfc376ee198d517.php(188): Twig\\Template-&gt;display()&quot;,
  &quot;#16 /var/www/html/vendor/twig/twig/src/Template.php(171): __TwigTemplate_da540ccf25f93ce4c0b8e858f9029c29-&gt;block_body()&quot;,
  &quot;#17 /var/www/html/storage/runtime/compiled_templates/9d/9d8bd5590419876189f181c8c8977abe.php(97): Twig\\Template-&gt;displayBlock()&quot;,
  &quot;#18 /var/www/html/vendor/twig/twig/src/Template.php(394): __TwigTemplate_4c7b3745a3e9b14219648aadfe96b4ff-&gt;doDisplay()&quot;,
  &quot;#19 /var/www/html/vendor/twig/twig/src/Template.php(367): Twig\\Template-&gt;displayWithErrorHandling()&quot;,
  &quot;#20 /var/www/html/storage/runtime/compiled_templates/fd/fde13f3141e76402b21db5d455240dc9.php(56): Twig\\Template-&gt;display()&quot;,
  &quot;#21 /var/www/html/vendor/twig/twig/src/Template.php(394): __TwigTemplate_f32667d358009b637e61728bdee46334-&gt;doDisplay()&quot;,
  &quot;#22 /var/www/html/vendor/twig/twig/src/Template.php(367): Twig\\Template-&gt;displayWithErrorHandling()&quot;,
  &quot;#23 /var/www/html/storage/runtime/compiled_templates/70/70646a7828221a1e0cfc376ee198d517.php(170): Twig\\Template-&gt;display()&quot;,
  &quot;#24 /var/www/html/vendor/twig/twig/src/Template.php(394): __TwigTemplate_da540ccf25f93ce4c0b8e858f9029c29-&gt;doDisplay()&quot;,
  &quot;#25 /var/www/html/vendor/twig/twig/src/Template.php(367): Twig\\Template-&gt;displayWithErrorHandling()&quot;,
  &quot;#26 /var/www/html/storage/runtime/compiled_templates/c4/c4c4c23760b1e14771ae195533230f2c.php(121): Twig\\Template-&gt;display()&quot;,
  &quot;#27 /var/www/html/vendor/twig/twig/src/Template.php(394): __TwigTemplate_2ac1813780c69ef710429dd220c8dd4b-&gt;doDisplay()&quot;,
  &quot;#28 /var/www/html/vendor/twig/twig/src/Template.php(367): Twig\\Template-&gt;displayWithErrorHandling()&quot;,
  &quot;#29 /var/www/html/vendor/twig/twig/src/Template.php(379): Twig\\Template-&gt;display()&quot;,
  &quot;#30 /var/www/html/vendor/twig/twig/src/TemplateWrapper.php(38): Twig\\Template-&gt;render()&quot;,
  &quot;#31 /var/www/html/vendor/twig/twig/src/Environment.php(280): Twig\\TemplateWrapper-&gt;render()&quot;,
  &quot;#32 /var/www/html/vendor/craftcms/cms/src/web/View.php(501): Twig\\Environment-&gt;render()&quot;,
  &quot;#33 /var/www/html/vendor/craftcms/cms/src/web/View.php(554): craft\\web\\View-&gt;renderTemplate()&quot;,
  &quot;#34 /var/www/html/vendor/craftcms/cms/src/web/TemplateResponseFormatter.php(57): craft\\web\\View-&gt;renderPageTemplate()&quot;,
  &quot;#35 /var/www/html/vendor/yiisoft/yii2/web/Response.php(1109): craft\\web\\TemplateResponseFormatter-&gt;format()&quot;,
  &quot;#36 /var/www/html/vendor/craftcms/cms/src/web/Response.php(338): yii\\web\\Response-&gt;prepare()&quot;,
  &quot;#37 /var/www/html/vendor/yiisoft/yii2/web/Response.php(340): craft\\web\\Response-&gt;prepare()&quot;,
  &quot;#38 /var/www/html/vendor/yiisoft/yii2/base/Application.php(390): yii\\web\\Response-&gt;send()&quot;,
  &quot;#39 /var/www/html/web/index.php(26): yii\\base\\Application-&gt;run()&quot;,
  &quot;#40 {main}&quot;],&quot;memory&quot;:11348240,&quot;exception&quot;:&quot;[object] (yii\\base\\InvalidArgumentException(code: 4): Syntax error at /var/www/html/vendor/yiisoft/yii2/helpers/BaseJson.php:147)&quot;} 
  </code></pre>
  <p><strong>console.log</strong></p>
  <pre><code>2024-08-21 06:52:40 [console.WARNING] [craft\console\actions\ClearCacheAction::run] Error clearing cache Control panel resources: Unable to clear control panel resources because the location isn't known for console commands. Explicitly set the @webroot alias in config/general.php to avoid this error. See https://craftcms.com/docs/4.x/config/#aliases for more info. {&quot;memory&quot;:27459016} 
  </code></pre>
  <p>The test environment is being hosted on platform.sh.</p>
  <p>Any help would be more than welcome. Thanks in advance!</p>
  
Tags: <craft5>
Title: Craft 5 update internal server error on hosting
ThreadText: # Craft 5 update internal server error on hosting
  
  (Asked by: username_0 on 2024-08-21)
  
  After following the required steps for the craft 5 upgrade, performing the update itself works locally.
  
  When I tried pushing it to the test server, which already had the neccessary work done to make the update go smoothly (updating plugins to latest versions, migrating typed link field and redactor, ...). Every page on the site (including admin pages) displays an "Internal server error".
  
  Following commands are fired when pushing to the server:
  
  * php craft clear-caches/all
  * php craft migrate/all
  * php craft project-config/apply
  * php craft clear-caches/all
  
  The server requirements seem to be correct so I don't really know what is going wrong here.
  
  The following errors are added to the log files:
  
  **web.log (on every page refresh)**
  
  ```
  2024-08-21 06:24:35 [web.ERROR] [yii\base\InvalidArgumentException] Syntax error {"trace":[
  "#0 /var/www/html/vendor/yiisoft/yii2/helpers/BaseJson.php(128): yii\\helpers\\BaseJson::handleJsonError()",
  "#1 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(2246): yii\\helpers\\BaseJson::decode()",
  "#2 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(3460): craft\\elements\\db\\ElementQuery->createElement()",
  "#3 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1708): craft\\elements\\db\\ElementQuery->_createElements()",
  "#4 /var/www/html/vendor/yiisoft/yii2/db/Query.php(251): craft\\elements\\db\\ElementQuery->populate()",
  "#5 /var/www/html/vendor/craftcms/cms/src/db/Query.php(292): yii\\db\\Query->all()",
  "#6 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1781): craft\\db\\Query->all()",
  "#7 /var/www/html/vendor/craftcms/cms/src/services/Globals.php(556): craft\\elements\\db\\ElementQuery->all()",
  "#8 /var/www/html/vendor/craftcms/cms/src/services/Globals.php(151): craft\\services\\Globals->_allSets()",
  "#9 /var/www/html/vendor/craftcms/cms/src/web/twig/variables/Cp.php(230): craft\\services\\Globals->getEditableSets()",
  "#10 /var/www/html/vendor/twig/twig/src/Extension/CoreExtension.php(1635): craft\\web\\twig\\variables\\Cp->nav()",
  "#11 /var/www/html/vendor/craftcms/cms/src/helpers/Template.php(148): twig_get_attribute()",
  "#12 /var/www/html/storage/runtime/compiled_templates/09/0962a246cc38eb3f42320868c2e3c859.php(64): craft\\helpers\\Template::attribute()",
  "#13 /var/www/html/vendor/twig/twig/src/Template.php(394): __TwigTemplate_4f43f22952f90733d4ba4874a2109b15->doDisplay()",
  "#14 /var/www/html/vendor/twig/twig/src/Template.php(367): Twig\\Template->displayWithErrorHandling()",
  "#15 /var/www/html/storage/runtime/compiled_templates/70/70646a7828221a1e0cfc376ee198d517.php(188): Twig\\Template->display()",
  "#16 /var/www/html/vendor/twig/twig/src/Template.php(171): __TwigTemplate_da540ccf25f93ce4c0b8e858f9029c29->block_body()",
  "#17 /var/www/html/storage/runtime/compiled_templates/9d/9d8bd5590419876189f181c8c8977abe.php(97): Twig\\Template->displayBlock()",
  "#18 /var/www/html/vendor/twig/twig/src/Template.php(394): __TwigTemplate_4c7b3745a3e9b14219648aadfe96b4ff->doDisplay()",
  "#19 /var/www/html/vendor/twig/twig/src/Template.php(367): Twig\\Template->displayWithErrorHandling()",
  "#20 /var/www/html/storage/runtime/compiled_templates/fd/fde13f3141e76402b21db5d455240dc9.php(56): Twig\\Template->display()",
  "#21 /var/www/html/vendor/twig/twig/src/Template.php(394): __TwigTemplate_f32667d358009b637e61728bdee46334->doDisplay()",
  "#22 /var/www/html/vendor/twig/twig/src/Template.php(367): Twig\\Template->displayWithErrorHandling()",
  "#23 /var/www/html/storage/runtime/compiled_templates/70/70646a7828221a1e0cfc376ee198d517.php(170): Twig\\Template->display()",
  "#24 /var/www/html/vendor/twig/twig/src/Template.php(394): __TwigTemplate_da540ccf25f93ce4c0b8e858f9029c29->doDisplay()",
  "#25 /var/www/html/vendor/twig/twig/src/Template.php(367): Twig\\Template->displayWithErrorHandling()",
  "#26 /var/www/html/storage/runtime/compiled_templates/c4/c4c4c23760b1e14771ae195533230f2c.php(121): Twig\\Template->display()",
  "#27 /var/www/html/vendor/twig/twig/src/Template.php(394): __TwigTemplate_2ac1813780c69ef710429dd220c8dd4b->doDisplay()",
  "#28 /var/www/html/vendor/twig/twig/src/Template.php(367): Twig\\Template->displayWithErrorHandling()",
  "#29 /var/www/html/vendor/twig/twig/src/Template.php(379): Twig\\Template->display()",
  "#30 /var/www/html/vendor/twig/twig/src/TemplateWrapper.php(38): Twig\\Template->render()",
  "#31 /var/www/html/vendor/twig/twig/src/Environment.php(280): Twig\\TemplateWrapper->render()",
  "#32 /var/www/html/vendor/craftcms/cms/src/web/View.php(501): Twig\\Environment->render()",
  "#33 /var/www/html/vendor/craftcms/cms/src/web/View.php(554): craft\\web\\View->renderTemplate()",
  "#34 /var/www/html/vendor/craftcms/cms/src/web/TemplateResponseFormatter.php(57): craft\\web\\View->renderPageTemplate()",
  "#35 /var/www/html/vendor/yiisoft/yii2/web/Response.php(1109): craft\\web\\TemplateResponseFormatter->format()",
  "#36 /var/www/html/vendor/craftcms/cms/src/web/Response.php(338): yii\\web\\Response->prepare()",
  "#37 /var/www/html/vendor/yiisoft/yii2/web/Response.php(340): craft\\web\\Response->prepare()",
  "#38 /var/www/html/vendor/yiisoft/yii2/base/Application.php(390): yii\\web\\Response->send()",
  "#39 /var/www/html/web/index.php(26): yii\\base\\Application->run()",
  "#40 {main}"],"memory":11348240,"exception":"[object] (yii\\base\\InvalidArgumentException(code: 4): Syntax error at /var/www/html/vendor/yiisoft/yii2/helpers/BaseJson.php:147)"} 
  
  ```
  
  **console.log**
  
  ```
  2024-08-21 06:52:40 [console.WARNING] [craft\console\actions\ClearCacheAction::run] Error clearing cache Control panel resources: Unable to clear control panel resources because the location isn't known for console commands. Explicitly set the @webroot alias in config/general.php to avoid this error. See https://craftcms.com/docs/4.x/config/#aliases for more info. {"memory":27459016} 
  
  ```
  
  The test environment is being hosted on platform.sh.
  
  Any help would be more than welcome. Thanks in advance!
  
  **Tags:** craft5
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2024-08-22. Score: 1
  
  Your deployment process is not installing PHP dependencies, including the updated version of Craft. Normally I'd expect a deployment script to include something like:
  
  ```
  composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader
  
  ```
  
  That should run first, to update Craft and its dependencies, before you begin running Craft commands.
  
  Additionally, you could run just `php craft up` to apply both migrations and project config changes, per: <https://craftcms.com/docs/3.x/console-commands.html#up-index>
  
  > **Comments:**
  > **username_0**: The platform file is configured to run composer install first. Running php craft up reports there are no new migrations or config changes.  
  > **username_2**: try `rm -rf ./vendor && composer i --no-scripts && php craft migrate/all && php craft project-config/apply && php craft clear-caches/all`  
  
  ---
  
  ### Answer by username_3 on 2024-08-30. Score: 0
  
  A few versions:
  Is PHP version >= 8.2?
  And do you have/use an .env file? If so, check that it present after upgrading to Craft 5.x.
  
  
  ---
  
  