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

8/22/2022 - Mon

if those are variable assignments, you can require/include the file that will preload the constants.
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:

Open in new window


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
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.

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.

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?

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

Echo Echo :)

forgive me :)