script.sh
-------------------------
the thing that bothers me is that every time I call app_app_name $* script_name I have to run source, which of course is required in this situation, but HOW TO MAKE IT RUN ONLY ONCE SOMEWHERE IN THE SYSTEM?
For instance if I put it in .bashrc it works fine when I open my linux console then I don't have to source again it reads .bashrc file, but PHP doesn't see this file so every time I call my application I need to source first as it is above in my script.
Moderator's Comments:
Please use next time code tags for your code and data
That's just how environment variables work. You can't change everyone's variables, only your own, and children get independent copies of every environment variable their parents have.
If you want something persistent and dynamic, i.e. make a change and everything sees it, then a database would be more appropriate, like mysql(which is very popular for use with php, and php supports almost everywhere). Or perhaps variables stored in sessions(which php again, supports almost everywhere).
Just for the sake of illuminating me (since i know nothing about php), can't he use something like putenv and define his enviroment in php code both local and global ?
thank you for reply. Sessions would be better then every time the same user as he clicks the link with the shell command is initiating the app enviroment, but how to do this? (or I should look for php forum).
putenv - I know nothing about this function only have read about it, but if it's possible and how...
I actually told you about this last time you asked...
No, you just mentioned about session_start and I've read more in manual the same thing what you have written below. I asked for technical help, because I don't have this knowledge how to use sessions in my case.
Quote:
Originally Posted by Corona688
session_start
At the beginning of your PHP script (it's vital that it happens before anything is printed, even spaces).
Then you can use the special $_SESSION variable to hold things in, and ought to have them carried between script instances.
Hello guys,
I need an open source tool that can list all the softwares installed in my unix/linux servers, the tool should list all the softwares installed and the current version, grouped by the hostname, anybody know any solution for this specific problem?
Thanks guys, have a good day! (7 Replies)
Hi,
I have created my VM lab on redhat linux, but giving me error after updating new yum repository, its asking me for subscription. I want want switch my redhat linux lab from VM, which linux open source will be best to perform admin commands and tasks??
If possible , please provide iso file... (2 Replies)
I have 7 functions those need to be executed as command line inputs, I tried with below code it’s not executing function. If I run the ./script 2 then fun2 should execute , how to initiate that function I tried case and if else also, how to initiate function from command line
if
then... (8 Replies)
Hi Frndz,
I am new to the makefile generation.
I have a source code which contains makefiles in each sub-directories.
Previously we have used the entire source code in Dtbuild environment to get the executables. Now have to change the current Dtbuild environment to Linux build... (1 Reply)
I've been usuing Suse 9.1 & 10 on 2 different machines for a while and have so far relied on ready compiled versions of programs in RPMs in order to install them.
I'm unclear what is envolved in compiling from the source code myself. I did a general google on the topic and found some unclear... (3 Replies)