What's the best way to read data from a bash configuration file (containing variable assignments) into php? Currently, my php data reads the required bash variables by assigning php variables via shell_exec. The bash code within the shell_exec statements greps for the appropriate values. An example might be: $myvar = shell_exec('grep myvar configfile.cfg | cut -d\" -f2'); However, it seems horribly inefficient to have to grep the entire configuration file for each php variable that I want to fetch. Since I'm relatively new at php, I know that there's GOT to be a better way to do this. Any suggestions?
While I would like to argue the reason why you need to do this in first place it should be a matter of reading the profile and extracting variable assignment in order to interpret these the way you want inside PHP.