beyondcode / herd-community

91 stars 1 forks source link

[Bug]: Set Global ENV values, like for the SnapPdf package's executuable path #1099

Closed Jacotheron closed 1 month ago

Jacotheron commented 1 month ago

Platform

Windows

Operating system version

Windows 11 23H2

System architecture

Intel (x86)

Herd Version

1.11.1

PHP Version

PHP 8.3.12

Bug description

I simply want to be able to set an ENV value for PHP that is global on my system (applicable to all sites). On my host I have done it by manually adding the ENV to all the relevant sites via Nginx config, as well as to the /etc/environment file.

I make use of SnapPdf to generate PDFs for various things, from Invoices to reports. It provides a very simple interface to generate the PDF using a Chromium-based executable (faster and using memory compared to other PHP based generators). Instead of having to keep an executable for each website (which would quickly fill up the drive), I have a global executable that will handle this.

On the server it now works fine, locally I want to replicate the server setup.

The slight issue is that SnapPdf is not a Laravel only package, and thus use no Laravel code at all. It makes use of "getenv" to get the path to the binary executable to use. If this is not found it tries its locally downloaded one.

I want to simply define this value once, and have all my local sites use it, whether in Command Line or HTTP.

I have tried adding "env[SNAPPDF_EXECUTABLE_PATH]=" to my php.ini, but it does not show up (php -i).

Steps to reproduce

No response

Relevant log output

No response