Laragon PHP loading wrong configuration files from environment variable
Hello, I was having an issue with using Laragon while having a separate PHP installed via Scoop. I already resolved this issue, but I am posting here to document my solution for anyone else who ends up with the same problem. And also if anyone else has found a better solution.
When I was trying to run a Grav website in Laragon, none of the pages would load. Grav would return this error message in my browser:
'mbstring' extension is not loaded. This is required for Grav to run correctly.
Turns out the Scoop PHP installation set a user environment variable PHP_INI_SCAN_DIR pointing to
/scoop/apps/php/current/cli/conf.d, and Laragon's PHP was loading the php.ini file at this location on top of its own php.ini file preventing some modules from loading correctly. Modifying this unwanted php.ini file would not fix it and replacing the PHP_INI_SCAN_DIR environment variable with SetEnv in the httpd.conf wouldn't fix the issue either, as Laragon's PHP would continue to load Scoop's php.ini file.
The only solution I found (besides uninstalling Scoop's PHP) was to remove the environment variable altogether, and now Laragon works fine. Hopefully scoops PHP works fine as VS Code uses it for its PHP extensions.