Hi, I am very new to php.
I am trying to execute a shell program from php.
Basically i am trying to execute the following shell command "ls -la > list.txt"
I ve tried exec() and shell_exec() functions but neither will do...
Basically it will execute ls-la or whoami or commands like that but it will not execute commands like mkdir or some command that will create a file.
I believe that the problem might be permission related.
I am using fedora core 6 (selinux disabled).
As far as I know apache on fedora has full permissions only on /tmp directory (which is where i try to create my files...).
Where can i search for error logs?
Thanx in advance people and sorry if i ask something stupid but i am really stuck...
how to execute shell commands (linux)?
Moderator: General Moderators
try&2>1 redirects STDERR to STDOUT. Maybe an error message shows up.
Code: Select all
$cmd = 'ls -la';
echo 'shell_exec: ', shell_exec($cmd . ' 2>&1');