I was trying to debug my CGI script which started with the line:
#!/usr/bin/env python3
Of course, the problem was that the environment variables (specifically, $PATH) of Apache HTTPd and my shell was different.
After some digging, I discovered that the system-level .profile for the shell sets the $PATH by calling /usr/libexec/path_helper. I verified this by calling /usr/libexec/path_helper and comparing the output with the output of echo $PATH.
The path of Apache HTTPd is different than this value. This makes me assume that the HTTPd sets the value of $PATH manually.
My question is, why? Why would a process set $PATH manually? I presume that /usr/libexec/path_helper is some sort of system standard, no?
So, the question is, why would a process set $PATH manually, instead of calling some sort of system level standard, which /usr/libexec/path_helper seems like a system level standard.