Find the answer to your Linux question:
Results 1 to 2 of 2
Hello, I have php page like this: <?php if (isset($_POST['logFilePath'])) { $logFilePath = $_POST['logFilePath']; } else logFilePath =""; $command = "wireshark " . $logFilePath ; shell_exec($command); ?> wireshark is a ...
  1. #1
    Just Joined!
    Join Date
    Aug 2008
    Posts
    10

    can not run linux external program with php through browser

    Hello, I have php page like this:

    <?php

    if (isset($_POST['logFilePath']))
    {
    $logFilePath = $_POST['logFilePath'];

    }
    else
    logFilePath ="";

    $command = "wireshark " . $logFilePath ;
    shell_exec($command);

    ?>
    wireshark is a linux application that analyze traffic or tcpdump format files

    I test echo shell_exec('ls');
    and it works but my command not.


    I copy wireshark at the current directory of my php page and change it chmod to 777 to give access of running it to apache but it doesn't work yet.

    when I run it as command line it works correctly and wireshark opens but when I run it through browser it doesn't work. What it the problem and how can i solve that.

  2. #2
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    Location
    NH, USA
    Posts
    3,149
    instead of just using the command as wireshark include the full path to the executable, my guess is its in a location that isn't on the apache user's path

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...