PHP not working (segmentation fault)

Creating a bug report/issue

Required Information

  • DietPi version | 8.5
  • Distro version | Debian Bullseye
  • Kernel version | Linux DietPi 5.15.32-v8+ #1538 SMP PREEMPT Thu Mar 31 19:40:39 BST 2022 aarch64 GNU/Linux
  • SBC model | RPi 4 Model B (aarch64)

Additional Information (if applicable)

  • Software title | PHP, Cron, Nextcloud, FreshRSS…
  • Was the software title installed freshly or updated/migrated?
    It has been installed for a few months already
  • Can this issue be replicated on a fresh installation of DietPi?
    Not too sure about this

Steps to reproduce

  1. Run php on a terminal
  2. Nothing happens, terminal output is Segmentation fault

Expected behaviour

It should just run php and run whatever script I am calling with it.

Actual behaviour

Nothing happens and my cronjobs are not executing properly

image

Extra details

It is PHP 7.4, I think it recently got updated via apt upgrade. And its now not working. This means that all of the cron jobs used by my applications are pretty much useless. For some reason the programs are still working, this only happens in the background, I am so confused

Welcome to our community

The following is not returning anything?

sudo -u www-data php -v

Pretty much, it is a really weird problem.

I think my berry lost power at some point without a proper shutdown and maybe that broke something somewhere? But, pretty much everything works except for background rss refreshing and stuff like that…

image

This usually means a broken binary or library. Please do an fsck first:

> /forcefsck
reboot

After reboot, check the logs whether there have been filesystem errors find and fixed, and whether PHP still fails:

journalctl -u systemd-fsck
php -v

If so, let’s try to reinstall the PHP CLI package:

apt install --reinstall php7.4-cli
php -v

Since the applications (the PHP FPM server) still work, it looks like the PHP base packages, modules and libraries are fine, but let’s see.

Thank you very much, this solved the Nextcloud warning, now I just have to wait a little bit to see if the cron is still working fine. I’ll keep you all updated

Alright, after a little bit I started having the expected behaviour again.
FreshRSS fetches new articles in the background and Nextcloud showed me updates and stopped showing a warning saying background checks had not been done in a while. Thank you a lot.

By the way, doind the forcefsck thing did not show me anything in the journals, so I am not sure what’s up with that. Reinstalling php-cli fixed it tho

Okay great, so probably the fs corruption for fixed already before, just leaving an incomplete or missing file or so. Great that the reinstall worked.

Probably, Btw I had already reinstalled PHP via dietpi-software, but it didn’t fix the issue, or maybe it didn’t reinstall php-cli?

Might be worth checking if that’s properly implemented in dietpi’s scripts

an expected behaviour of dietpi-software reinstall <software_ID> as it is not a full reinstall of the package. It’s more a try to install the package again using apt install <package>. But it will not force the re-installation of the package as long as the package is marked as correctly installed. To force the re-installation, you need to manually execute apt install --reinstall <package>

2 Likes