echo shell_exec("ll");
Why doesn’t php show me a list of files and directories when I run this code?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
llisn’t the command. I believe thatecho shell_exec("ls");will output a list of directories.Also you can have some problems if you are running PHP in safe mode. Here you have more information: http://php.net/manual/en/function.shell-exec.php
Eventually, you have more secure alternatives to execute a command in a bash like
readdir: http://php.net/manual/en/function.readdir.php. This is a function that read the files that are in a certain directory.readdir($dir_handle)example: