Page 1 of 1
PHP shell scripting problem
Posted: Mon Mar 06, 2006 7:09 am
by MathewByrne
I'm trying to implement a quick php shell script which will take me to a specified directory. This doesn't work however:
In fact nothing happens inside bash. Is this a limitation of scripting in PHP?
Re: PHP shell scripting problem
Posted: Mon Mar 06, 2006 7:17 am
by Chris Corbyn
MathewByrne wrote:I'm trying to implement a quick php shell script which will take me to a specified directory. This doesn't work however:
In fact nothing happens inside bash. Is this a limitation of scripting in PHP?
Nope. PHP does change it's working directory.... but that's only local to the script... it won't effect your bash environment.
You could possibly try this but it'll no doubt have the same result:
Posted: Mon Mar 06, 2006 7:26 am
by MathewByrne
Yeah I noticed calling getcwd(); had changed. Hmm... might have to actually write a shell script for once... Anyone have a better solution?
Posted: Mon Mar 06, 2006 7:40 am
by Chris Corbyn
MathewByrne wrote:Yeah I noticed calling getcwd(); had changed. Hmm... might have to actually write a shell script for once... Anyone have a better solution?
Even BASH scipts do the same thing. I'm not sure what the solution is but it must be very simple... I've tried and failed in the past too.
Posted: Mon Mar 06, 2006 8:14 am
by MathewByrne
Ah well, I'll make do with a buch of alias ___='cd ...___' for now

Posted: Thu Mar 09, 2006 8:23 am
by dubbelpunt
if you need to change your directory, you can use the function chdir().