PHP Error Log with Ubuntu 22.04

SYSTEM INFORMATION
OS type and version Ubuntu 22.04
Virtualmin version 7.7

I migrated my website from Ubuntu 20.04 server to Ubuntu 22.04 server and the website is displaying this error “The website encountered an unexpected error. Please try again later.”

I checked the PHP Error Log and I’m getting this:
#7 /home/domain-name/public_html/core/modules/views/src/ViewExecutable.php(1635): Drupal\views\Plugin\views\display\Page->execute()
#8 /home/domain-name/public_html/core/modules/views/src/Element/View.php(81): Drupal\views\ViewExecutable->executeDisplay()
#9 [internal function]: Drupal\views\Element\View::preRenderViewElement()
#10 /home/domain-name/public_html/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(101): call_user_func_array()
#11 /home/domain-name/public_html/core/lib/Drupal/Core/Render/Renderer.php(788): Drupal\Core\Render\Renderer->doTrustedCallback()
#12 /home/domain-name/public_html/core/lib/Drupal/Core/Render/Renderer.php(374): Drupal\Core\Render\Renderer->doCallback()
#13 /home/domain-name/public_html/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender()
#14 /home/domain-name/public_html/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(242): Drupal\Core\Render\Renderer->render()
#15 /home/domain-name/public_html/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent{closure}()
#16 /home/domain-name/public_html/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(243): Drupal\Core\Render\Renderer->executeInRenderContext()
#17 /home/domain-name/public_html/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(132): Drupal\Core\Render\MainContent\HtmlRenderer->prepare()
#18 /home/domain-name/public_html/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse()
#19 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
#20 /home/domain-name/public_html/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(142): call_user_func()
#21 /home/domain-name/public_html/vendor/symfony/http-kernel/HttpKernel.php(174): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
#22 /home/domain-name/public_html/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#23 /home/domain-name/public_html/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
#24 /home/domain-name/public_html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#25 /home/domain-name/public_html/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#26 /home/domain-name/public_html/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#27 /home/domain-name/public_html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#28 /home/domain-name/public_html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#29 /home/domain-name/public_html/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#30 /home/domain-name/public_html/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle()
#31 /home/domain-name/public_html/index.php(19): Drupal\Core\DrupalKernel->handle()
#32 {main}

Any help on how to fix this issue please?
Thanks!

Don’t think this has anything to do with Virtualmin. This has to do with “Drupal” as all the errors indicate that. Perhaps they are using a different version of PHP ?

Interesting, which Drupal version and PHP Version you’re using at the moment?

If you are using Ubuntu’s standard repos for PHP, then you will now be on PHP 8.1.2

You need Drupal 7.92 or 9.3.0 and later for PHP 8.1 support.

Actually, the php version is different from the previous installation. Ok, I will try a different version. Thank you!

I’m using the PHP version 8.1.2 that comes by default with Ubuntu 22.04. Any instruction on how to install a lower version of php please?
Thanks!

https://www.virtualmin.com/documentation/web/multiplephp/

just change install to suite
ie for 7.4
apt-get install php7.4-{cgi,cli,fpm,pdo,gd,mbstring,mysqlnd,opcache,curl,xml,zip}

Thank you. But, I think that the problem with php 7.4 is that it will not work with the default version on Mariadb.

What makes you think that?

I’m using Drupal 9.4 and this could be my problem. " Following the development of Drupal 9.4.0, we have discovered PHP versions 8.1.0-8.1.5 have a bug with the PHP OPcache that may cause intermittent fatal errors at runtime for class autoloading. The issue is resolved in PHP 8.1.6."
I think that it will be better to update the php version instead from 8.1.2 to 8.1.6 if it’s possible and easier.

If php 7.4 will work with MariaDB version 10.6.12, then I can try 7.4. I tried that before and it did not work.

I don’t know if it will. But, I would assume that a PHP package built for Ubuntu 22.04 would bind to the database libraries on Ubuntu 22.04.

But, a very old version of PHP may very well have a problem with a very new version of MariaDB. But, I’d need to see the errors or some sort of documentation for me to assume it won’t work.

I never think it a good idea to downgrade anything (especially a core program something like PHP) so I would be looking more at the root problem - Drupal
If you have Drupal 9.4 and that requires PHP 8.1.6 then surely you need to upgrade PHP from the default PHP 8.1.2 ?

Thank you. I gave up on ubuntu 22.04. I installed Ubuntu 20.04, added php 8.1.2 and it worked without error.
Thanks for all the helps.

Good to hear that the problem is resolved (or rather bypassed) for now. But that is still a step backwards and a downgrade. What happens when 20.04 goes EOL? I would be tempted to spin up a separate 22.04 box and install a fresh Drupal and investigate further. I still think this is a Drupal issue at heart, maybe something in the way it uses PHP or one of Drupal’s add-ons (I’m afraid I have the same negative view of Drupal as I have of WordPress) and are one of the reasons I disable PHP

Yes, I will try this. Thanks again!

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.