I would like to change the directory in a Linux terminal using a cli script, not the current PHP working directory - hopefully using shell_exec ().
Example: from user@host:~$touser@host:/the/other/directory$
system()and exec()not allowed.
In my case, this does not work:
$dir = '/the/other/directory';
shell_exec('cd '.$dir);
and these
shell_exec('cd '.escapeshellarg($dir));
shell_exec(escapeshellcmd('cd '.$dir));
pclose(popen('cd '.$dir));
But shell_exec('ls '.$dir)gives me a list in this directory. Any cheaters?
source
share