this post was submitted on 15 Dec 2023
1 points (100.0% liked)

Linux

4477 readers
18 users here now

A community for everything relating to the linux operating system

Also check out [email protected]

Original icon base courtesy of [email protected] and The GIMP

founded 1 year ago
MODERATORS
 

Hi all

I have an Alpine container on Proxmox that we use as a Zabbix Proxy. On it there is a PHP script (no web server). When I ssh in with my normal user account and run the PHP from cli, it works great. When I su to user root (for testing) it works fine. But when I su to user zabbix, I get:
Class "PhpOffice\PhpSpreadsheet\Spreadsheet" not found

This a problem because it will be Zabbix that triggers the script once a day. I get the same error whether zabbix triggers the script, or I trigger it from cli.

I have other ash, php, and python scripts on the proxy that run just fine when Zabbix triggers them.

The require statements at the top of the script don't throw an error:
require $folder . "/phpSpreadsheet/vendor/autoload.php"; use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Writer\Xlsx;

The error happens farther down when it creates a new spreadsheet in memory: $spreadsheet = new Spreadsheet();

I had to use Composer to install the phpSpreadsheet library. I was getting a bunch of file & folder permissions errors but I'm certain I've covered that as this is not a file permissions error. I even reran composer as the zabbix user to check for permissions.

From googling I've found that the zabbix user is a "service account" as opposed to a user account. I used "su zabbix -s /bin/ash" get a cli going so I could test running the script directly. Running env shows that the Zabbix user's HOME directory is "/dev/null" Beyond that I'm not sure what differences there are between the accounts, or what would prevent a php class from loading.

Any help is welcome. Thanks.

no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here