You are looking for chdir . This is a PHP function.
shel_exec('cd /some/where'); It works just fine (it changes the current shell_exec to another directory), but it will not be held in the current directory after shell_exec completes. This means that the following command will not use the same state that would be changed by calling cd .
source share