LinuxターミナルのディレクトリをPHPの現在の作業ディレクトリではなく、 cliスクリプトから変更したいと思います。できればshell_exec()を使用してください。
例:user@host:~$
からuser@host:/the/other/directory$
system()
とexec()
許可されていません。
私の場合、これは機能していません。
$dir = '/the/other/directory';
shell_exec('cd '.$dir);
これらも
shell_exec('cd '.escapeshellarg($dir));
shell_exec(escapeshellcmd('cd '.$dir));
pclose(popen('cd '.$dir));
しかしshell_exec('ls '.$dir)
、そのディレクトリのリストを教えてください。何かトリックはありますか?