linguafranca Posted June 8, 2008 Share Posted June 8, 2008 Hi! I should mention that I'm horrible at php. I did my googling, and asked somebody before coming here though. Anyhow, I'm stuck, and I need help. I'd like to run Tomcat's '/bin/startup.sh' startup script with php (BTW, Tomcat - a java "server"; it is run by executing the forementioned script). When I write: echo exec('MY_PATH/tomcat6/bin/startup.sh'); I get the response that "At least one of these environment variable is needed to run this program" which looks like the last line of tomcat's common error message: Neither the JAVA_HOME nor the JRE_HOME environment variable is defined At least one of these environment variable is needed to run this program When I run: echo exec('export JRE_HOME=MY_PRECIOUS_PATH'); it neither helps nor returns anything. Is it possible to set an environment variable for www-data account with php? Thanks in advance! Quote Link to comment Share on other sites More sharing options...
marklarah Posted June 9, 2008 Share Posted June 9, 2008 exec() is actually disabled by most shared hosts, and im not sure if by default. It poses some security risks. I had the same problem. If you are not shared, edit php.ini. you might find thats the problem. If it isn't, im not really sure, sorry. Quote Link to comment Share on other sites More sharing options...
keeB Posted June 9, 2008 Share Posted June 9, 2008 http://us.php.net/putenv It works. Quote Link to comment Share on other sites More sharing options...
keeB Posted June 9, 2008 Share Posted June 9, 2008 Example: putenv("JAVA_HOME=/usr/lib/jdk"); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.