Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Ping not running

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

  1. checked

    checked Well-Known Member

    May 3, 2004
    Likes Received:
    Trophy Points:
    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.
    echo 'Ping : ';

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

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

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

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

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

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

    "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 Verifed Vendor

    Jun 15, 2002
    Likes Received:
    Trophy Points:
    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 ;)
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice