Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to access PHP error logs? #5

Open
maskedjellybean opened this issue Oct 1, 2020 · 4 comments
Open

How to access PHP error logs? #5

maskedjellybean opened this issue Oct 1, 2020 · 4 comments
Labels
v4 Consider in v4 of Lando

Comments

@maskedjellybean
Copy link

How can I access PHP error logs in Lando?

I've found several similar issues, but none of them allow you access to true error logs. At best they give you access to logs loosely related to PHP but are useless for resolving the cause of errors.

What I want is full access to error logs like you would be able to configure while hosting a site via localhost Apache and PHP.

Here's what I've attempted so far:

.lando.yml
(relevant pieces only)

config:
  framework: drupal7
  php: '7.1'
  via: apache
  database: mysql
  webroot: docroot
  drush: ^8
  xdebug: false
  config:
    # Custom PHP config overrides.
    php: lando/php-conf/php.ini
services:
  appserver:
    build_as_root:
      - touch /var/log/php_errors.log

Note that in the build process I am creating /var/log/php_errors.log.

lando/php-conf/php.ini

error_log = /var/log/php_errors.log

Then I followed these steps:

  • lando rebuild
  • lando ssh
  • php -i | grep error. Here I see error_log => /var/log/php_errors.log => /var/log/php_errors.log. This looks correct.
  • ls /var/log/. Here I see php_errors.log.
  • tail -f /var/log/php_errors.log. I see nothing.
  • I trigger a PHP error. I still see nothing in the tail process.

Am I missing something obvious? Wouldn't this be super useful for everyone? Thanks for any help.

@kirederfso
Copy link

Can't you see these logs using the lando logs command?
For instance lando logs -s appserver or whatever service you are using for php.
For more information: https://docs.lando.dev/basics/logs.html#usage
I hope this helps you.

@stale
Copy link

stale bot commented Apr 27, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions and please check out this if you are wondering why we auto close issues.

@reynoldsalec
Copy link
Member

This was a great reminder that we should document the easiest way to get PHP log output (per lando/docs#31). I took some of the advice from here, lando/lando#315, and lando/docs#31 to make a doc guide.

When the next tagged Lando release comes out, it'll be available here: https://docs.lando.dev/guides/accessing-php-logs.html

@reynoldsalec
Copy link
Member

Going to mark this as something to consider in v4; note that I did try the OP's steps and had the same issue (my php.ini setting seemed to be ignored and I didn't get PHP log entries in /var/log).

@rtfm-47 rtfm-47 transferred this issue from lando/lando Dec 21, 2021
@reynoldsalec reynoldsalec added v4 Consider in v4 of Lando and removed Needs Triage labels Dec 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v4 Consider in v4 of Lando
Projects
None yet
Development

No branches or pull requests

4 participants