How to install NewRelic PHP agent for OpenLiteSpeed?

OpenLiteSpeed uses custom php (lsphp) that is located in "/usr/local/lsws/lsphpXX/bin". Because of this if I'm following the standard instructions that NewRelic provides, I fail on the following step because:
  • php is not globally available
  • If I try to replace php with "/usr/local/lsws/lsphp80/bin/php" or "/usr/local/lsws/lsphp80/bin/lsphp" the installation instead fails to find "php.d" directory to put the newrelic.ini in.
sed -i -e "s/REPLACE_WITH_REAL_KEY/eu01xx0a0828ac2862775660da507408e11cNRAL/" \
  -e "s/newrelic.appname[[:space:]]=[[:space:]].\*/newrelic.appname=\"${NEWRELIC_APP_NAME}\"/" \
  $(php -r "echo(PHP_CONFIG_FILE_SCAN_DIR);")/newrelic.ini