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

Validate PHP version mismatch #11621

Merged
merged 2 commits into from
May 16, 2020
Merged

Conversation

murrant
Copy link
Member

@murrant murrant commented May 15, 2020

If the webserver does not match the cli version this means they recently upgraded and have not restarted the service.

This can cause errors with some cached data.

DO NOT DELETE THE UNDERLYING TEXT

Please note

Please read this information carefully. You can run ./scripts/pre-commit.php to check your code before submitting.

  • Have you followed our code guidelines?
  • If my Pull Request does some changes/fixes/enhancements in the WebUI, I have inserted a screenshot of it.

Testers

If you would like to test this pull request then please run: ./scripts/github-apply <pr_id>, i.e ./scripts/github-apply 5926
After you are done testing, you can remove the changes with ./scripts/github-remove. If there are schema changes, you can ask on discord how to revert.

@murrant murrant changed the title Validate php mismatch Validate PHP version mismatch May 15, 2020
$web_version = PHP_VERSION;
$cli_version = rtrim(shell_exec('php -r "echo PHP_VERSION;"'));
if (version_compare($web_version, $cli_version, '!=')) {
$validator->fail("PHP version of your webserver ($web_version) does not match the cli version ($cli_version)", "If you updated PHP recently, restart php-fpm or apache to switch to the new version");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmh ... "restart php-fpm, apache. nginx or what webserver you use.. " ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

restarting nginx will never have any affect on the php version.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and you can use php-fpm with apache

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To nitpick you can run php other ways than php-fpm in that case, Nginx unit is one way :)
Point is we can't cover all use cases, some things need to be left to the sysadmin.

@SourceDoctor SourceDoctor self-requested a review May 15, 2020 18:02
Copy link
Member

@SourceDoctor SourceDoctor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@murrant murrant merged commit 216f16f into librenms:master May 16, 2020
@murrant murrant deleted the validate-php-mismatch branch May 16, 2020 04:45
@murrant
Copy link
Member Author

murrant commented May 31, 2020

This pull request has been mentioned on LibreNMS Community. There might be relevant details there:

https://community.librenms.org/t/v1-64-release-changelog-may-2020/12290/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants