Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Member
    Join Date
    May 2004
    Posts
    58

    Default Ping not running

    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 Code:
    <?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. #2
    Super Moderator This forum account has been confirmed by cPanel staff to represent a vendor. chirpy's Avatar
    Join Date
    Jun 2002
    Location
    Go on, have a guess
    Posts
    13,495

    Default

    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
    Jonathan Michaelson

    Need your cPanel servers secured and tuned?
    cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
    Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
    http://www.configserver.com

Similar Threads & Tags
Similar threads

  1. IP - Ping problems
    By KirkColvin747 in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 04-07-2005, 09:54 AM
  2. Bind is running, but server can't ping any outside sites?
    By noimad1 in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 02-03-2005, 12:39 PM
  3. how to disable ping
    By gopal in forum cPanel and WHM Discussions
    Replies: 6
    Last Post: 05-01-2004, 06:37 PM
  4. Ping
    By xp2u in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 05-14-2003, 10:33 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube