| | |
exec() command and PATH issues
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Mar 2008
Posts: 38
Reputation:
Solved Threads: 1
Hi all,
I'm using exec() to launch external commands from a web application under OS X Leopard. To put my problem in context, when I launch this:
exec ("export", $output);
I get this:
export OLDPWD
export PATH="/usr/bin:/bin:/usr/sbin:/sbin"
export PWD="/Library/WebServer/Documents"
export SHLVL="1"
My problem is with PATH, I need to include other directories in there. I've been searching for some time now but can't put my finger on it. Any ideas?
Thanks!
I'm using exec() to launch external commands from a web application under OS X Leopard. To put my problem in context, when I launch this:
exec ("export", $output);
I get this:
export OLDPWD
export PATH="/usr/bin:/bin:/usr/sbin:/sbin"
export PWD="/Library/WebServer/Documents"
export SHLVL="1"
My problem is with PATH, I need to include other directories in there. I've been searching for some time now but can't put my finger on it. Any ideas?
Thanks!
Last edited by LeBurt; Mar 28th, 2008 at 11:38 am.
•
•
Join Date: Mar 2008
Posts: 38
Reputation:
Solved Threads: 1
There's nothing like posting a question to find the answer yourself shortly after...
I solved my problem by adding this at the beginning of my script:
putenv("PATH=" .$_ENV["PATH"]. "my/other/directories");
Works well, however I suspect there is another, more elegant, way to set the PATH in a .ini or .conf file somewhere. I looked at php.ini but didn't really see anything relevant in there.
Where might it be?
Thanks.
I solved my problem by adding this at the beginning of my script:
putenv("PATH=" .$_ENV["PATH"]. "my/other/directories");
Works well, however I suspect there is another, more elegant, way to set the PATH in a .ini or .conf file somewhere. I looked at php.ini but didn't really see anything relevant in there.
Where might it be?
Thanks.
•
•
Join Date: Mar 2009
Posts: 1
Reputation:
Solved Threads: 0
You may try something like:
in your httpd.conf
I was running wamp under windows, and my solution was to set the windows path, and then rebooting. But your solution pointed me in the right direction, so thank you!
PHP Syntax (Toggle Plain Text)
SetEnv PATH my/other/directories
I was running wamp under windows, and my solution was to set the windows path, and then rebooting. But your solution pointed me in the right direction, so thank you!
![]() |
Similar Threads
- popups persist despite all efforts, load.html in temp folder... (Viruses, Spyware and other Nasties)
Other Threads in the PHP Forum
- Previous Thread: Warning: Wrong parameter count for mysql_query()
- Next Thread: Incrementing input per paragraph
| Thread Tools | Search this Thread |
apache api array beginner binary broken cache cakephp checkbox class cms code confirm cron curl customizableitems database date display dynamic echo email error external fcc file files folder form forms forum freelancing function functions google header headmethod howtowriteathesis href htaccess html iframe image include insert ip javascript joomla limit link login mail malfunction menu method mlm mod_rewrite multiple mysql neutrality oop pageing pagerank paypal pdf php phpmysql play problem query question radio random recursion remote root script search select server sessions sms soap source space sql support! syntax system table template tutorial update upload url validator variable video web youtube





