I need to add an additional path to my Apache configuration for PHP. Ideally, it would be Serverwide but as I’m using ServerPilot it’s easier to just affect the individual VirtualHosts.
The Path is currently set to PATH /opt/sp/php7.3/bin:/sbin:/usr/sbin:/bin:/usr/bin but I need to additionally add /opt/sqlanywhere17/res
eg /opt/sp/php7.3/bin:/sbin:/usr/sbin:/bin:/usr/bin:/opt/sqlanywhere17/res
I have tried adding
export PATH=$PATH:/opt/sqlanywhere17/res
but apache fails to start
What syntax do I need to use in the VirtualHosts .conf file to make this work???
2
Answers
You can set env variblae using SetEnv in Apache httpd.
Refer link for more information.
You can set path environment variable inside VirtualHost.
Then you can retrieve the path variable in PHP using below sample code:
To append a path to the PATH env var, you can do this: