Changing PHP's directory when working with Git
Posted: Mon Mar 15, 2010 10:52 am
Hello,
I am working in conjuction with PHP and Git. To get things done, i am exectuting shell commands using php's shell_exec and exec functions, but I keep on having to change the directory to where I need the command to be run (only for working trees). Once the directory is changed, in some places where I am using the require() function to include files local to the source code folder, I get a message that no file exists, since I am no longer in the source code's directory. I could change the directory back to where it should point to, but I figure this isn't the best way of going about this, and requires a lot of manual work. Any ideas on how to keep the current directory path consistent, while simultaneously being running shell commands in other directories? Or is changing directories on an as needed basis the best way to do this?
Fanks,
Jawad.
I am working in conjuction with PHP and Git. To get things done, i am exectuting shell commands using php's shell_exec and exec functions, but I keep on having to change the directory to where I need the command to be run (only for working trees). Once the directory is changed, in some places where I am using the require() function to include files local to the source code folder, I get a message that no file exists, since I am no longer in the source code's directory. I could change the directory back to where it should point to, but I figure this isn't the best way of going about this, and requires a lot of manual work. Any ideas on how to keep the current directory path consistent, while simultaneously being running shell commands in other directories? Or is changing directories on an as needed basis the best way to do this?
Fanks,
Jawad.