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
LinuxScripting LanguagesPHP

Avatar of undefined
Last Comment
weissman

8/22/2022 - Mon
arnold

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
gr8gonzo

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Ray Paseur

Would be helpful to see the file so we can see how it is going to interact with the PHP script.
ASKER
weissman

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
Your help has saved me hundreds of hours of internet surfing.
fblack61
gr8gonzo

Ummm... if you used shell_exec, then why didn't you accept my answer?
Ray Paseur

Ummm... if you used shell_exec, then why didn't you accept gr8gonzo's answer?
gr8gonzo

Echo? :)
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Ray Paseur

Echo Echo :)
ASKER
weissman

forgive me :)