Link to home
Start Free TrialLog in
Avatar of weissman
weissmanFlag for Israel

asked on

read from a consts file in php

i have a file that include constants that is used as Enivroment parameters.

in perl i can get the value of a specific variable like this:

$host=`. /xxx.consts; echo \$JBOSS_HOST`;

how to perform the same opration in PHP

note: i couldn't use parse_ini_file() because i canot change the xxx.consts file to ini  

thanks a lot
Avatar of arnold
arnold
Flag of United States of America image

if those are variable assignments, you can require/include the file that will preload the constants.
http://www.w3schools.com/PHP/php_includes.asp
perl would also use a use/require to preload variable assignments.

What are the contents of the file?

is the xxxxx.constant file something like:
#!/usr/bin/perl
$JBOSS_HOST="somehostname";
1;

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of gr8gonzo
gr8gonzo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Would be helpful to see the file so we can see how it is going to interact with the PHP script.
Avatar of weissman

ASKER

i have use the echo shell_exec() in the end

note: the consts was calling the shell so i call it directly from php

thanks a lot
Ummm... if you used shell_exec, then why didn't you accept my answer?
Ummm... if you used shell_exec, then why didn't you accept gr8gonzo's answer?
Echo? :)
Echo Echo :)
forgive me :)