Problem/Motivation

Getting php errors from drd_agent on Pantheon

Steps to reproduce

Appears in the error log when drd_agent is called. The error is the system cannot open settings,pantheon,php. From the error message it is looking in the wrong place. It is looking for it at - '/code/web/modules/contrib/drd_agent/src/Agent/Action/settings.pantheon.php'
It is actually located at - 'web/sites/default/settings.pantheon.php'

Error log:

Type php
Date Wednesday, February 5, 2025 - 01:00
User Anonymous (not verified)
Location https://xxxxxx/drd-agent
Referrer
Message Warning: include(): Failed opening '/code/web/modules/contrib/drd_agent/src/Agent/Action/settings.pantheon.php' for inclusion (include_path='/code/vendor/pear/archive_tar:/code/vendor/pear/console_getopt:/code/vendor/pear/pear-core-minimal/src:/code/vendor/pear/pear_exception:.:/usr/share/pear:/usr/share/php') in include() (line 2 of /code/web/modules/contrib/drd_agent/src/Agent/Action/DomainsReceive.php(123) : eval()'d code)

#0 /code/web/core/includes/bootstrap.inc(166): _drupal_error_handler_real(2, 'include(): Fail...', '/code/web/modul...', 2)
#1 /code/web/modules/contrib/drd_agent/src/Agent/Action/DomainsReceive.php(123) : eval()'d code(2): _drupal_error_handler(2, 'include(): Fail...', '/code/web/modul...', 2)
#2 /code/web/modules/contrib/drd_agent/src/Agent/Action/DomainsReceive.php(123) : eval()'d code(2): include('/code/web/core/...')
#3 /code/web/modules/contrib/drd_agent/src/Agent/Action/DomainsReceive.php(123): eval()
#4 /code/web/modules/contrib/drd_agent/src/Agent/Action/DomainsReceive.php(64): Drupal\drd_agent\Agent\Action\DomainsReceive->readSettings('default', '/code/web/sites...')
#5 /code/web/modules/contrib/drd_agent/src/Agent/Action/DomainsReceive.php(18): Drupal\drd_agent\Agent\Action\DomainsReceive->readSites()
#6 /code/web/modules/contrib/drd_agent/src/Agent/Action/Base.php(341): Drupal\drd_agent\Agent\Action\DomainsReceive->execute()
#7 /code/web/modules/contrib/drd_agent/src/Controller/Agent.php(79): Drupal\drd_agent\Agent\Action\Base->run(false)
#8 [internal function]: Drupal\drd_agent\Controller\Agent->get()
#9 /code/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#10 /code/web/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#11 /code/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#12 /code/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#13 /code/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#14 /code/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#15 /code/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#16 /code/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#17 /code/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#18 /code/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#19 /code/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(116): Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#20 /code/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(90): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#21 /code/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#22 /code/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#23 /code/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#24 /code/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#25 /code/web/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#26 /code/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#27 {main}
.
Severity Warning

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork drd_agent-3504657

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

adrianm6254 created an issue. See original summary.

jurgenhaas’s picture

I assume that settings.pantheon.php gets included by something else? Can you please provide, where this file is being included and how that exact include statement looks like? DRD Agent is not looking for that file by itself, it wants to load settings.php and it's likely that this file is referring to the other one. So, we need to know where those files are stored and how one includes the other.

adrianm6254’s picture

The code to include settings.pantheon.php is in settings.php, and the file settings.pantheon.php is located at web/sites/default/settings.pantheon.php

The include code in settings.php is:


/**
 * Include the Pantheon-specific settings file.
 *
 * n.b. The settings.pantheon.php file makes some changes
 *      that affect all environments that this site
 *      exists in.  Always include this file, even in
 *      a local development environment, to ensure that
 *      the site settings remain consistent.
 */
include __DIR__ . "/settings.pantheon.php";

jurgenhaas’s picture

Version: 4.1.2 » 4.1.x-dev
Category: Bug report » Feature request
Status: Active » Needs review

This is actually not an error, it's just a warning. And the include statement in the settings.php file is pretty un-common. That should look like this instead:

if (file_exists(__DIR__ . '/settings.pantheon.php')) {
  include __DIR__ . '/settings.pantheon.php';
}

However, I've provided an MR that should resolve this in addition to the recommended adjustment to your setting file.

jurgenhaas’s picture

Title: Getting php errors from drd_agent on Pantheon » Getting php warnings from drd_agent on Pantheon
adrianm6254’s picture

I made the change in settings.php and I applied the MR! 11 patch and the warnings stopped.

Thanks!

bsnodgrass’s picture

Status: Needs review » Reviewed & tested by the community

Thanks Jurgen! This looks good.

Changing status to RTBC, do you expect this to be included in a release anytime soon, or should we go ahead and just use the patch for the time being?

  • jurgenhaas committed 277faae8 on 4.1.x
    Issue #3504657 by jurgenhaas, adrianm6254, bsnodgrass: Getting php...
jurgenhaas’s picture

Status: Reviewed & tested by the community » Fixed

Thank you all for helping with this. I've just tagged a new release 4.1.3

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.