The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Ping not running

Discussion in 'General Discussion' started by checked, Jul 7, 2004.

  1. checked

    checked Well-Known Member

    Joined:
    May 3, 2004
    Messages:
    54
    Likes Received:
    0
    Trophy Points:
    6
    I am on Redhat 9 and Safe Mode is off. I checked a ping program but it is not showing any result. I have tried so many commands to run the ping from PHP it does not show any result.
    PHP:
    <?php
    echo 'Ping : ';

    // It is showing RESULTS
    $last_line system('ls -la');    

    // Not showing anything
    //$last_line = system('ping -c 5 google.com', $retval);    

    // Not showing anything
    //$last_line = passthru("ping -c 5 google.com", $retval);
    //echo $last_line. "  ". $retval;

    // Not showing anything
    //$a = shell_exec("ping -c 5 google.com");

    // Not showing anything
    $a shell_exec('ping');


    // It is created folder successfully
    echo mkdir("/home/frmwhev4/www/abc/Folder");

    echo 
    "folder created";
    ?>

    When I tried to run system('ls -la'); command it shows the result but when I place the command system('ping'); it does not show any result whereas it should show some output.

    Note: I am able to run ping from SSH but not able to run from PHP. Below are the ping Permissions

    -rwsr-xr-x 1 root bin 28628 Jan 24 2003 ping*


    Can anyone know the problem !
     
  2. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Do you have open_basedir protection enabled? WHM > Tweak Security > php open_basedir Tweak

    If you do, then you cannot access binaries outside of your account tree. What you might be able to do is create a symlink to it in your account via ssh and then use that. So, SSH in and:

    cd /home/account/
    ln -s /bin/ping

    Then in your script use /home/account/ping instead of just ping - might work ;)
     
Loading...

Share This Page