Does anyone know how to get bash files to render php constants? For example if i create a php file containing,
define('__ROOT__', dirname(dirname(__FILE__)));
define("APPDIR", dirname(__FILE__).'/');
define("VIEW", APPDIR.'views/');
echo APPDIR;
and, I then create a shell script containing:
echo "Good morning, world."
APPDIR = '/var/www/site-root'
export APPDIR
`php -e test.php`
I am trying to see if when I run the shell script that then executes the php script that it acknowledges the constants that are being set in PHP. Right now, the echo statement in php prints out "APPDIR" instead of /var/www/site-root.
The issue is i have shell crons that interrogate the php code and there are a series of require and includes that have constants that construct their file paths. I need the shell to adhere to those constants. I have had to use php $variable = "path" to get both the web app and the crons to be able to locate all the needed files for execution.
As you can see, i have tried exporting the variable from shell and making it an environment variable available to both bash and php to no avail.
Thoughts, ideas? Thanks