why is which not working?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • yusuf

    #1

    why is which not working?

    Hi,

    I uploaded the following file to my site:

    <?php
    header("Content-type: text/plain");

    echo "latex is at: ";
    system("which latex");

    echo "ls is at: ";
    system("which ls");

    echo "convert is at: ";
    system("which convert");

    echo "gs is at: ";
    system("which gs");

    ?>

    and none of the paths are being printed out, only the echo statements
    are... I would think atleast ls should show up? Execute permissions
    have been given to it too.

  • Kimmo Laine

    #2
    Re: why is which not working?

    "yusuf" <yusufm@gmail.c omwrote in message
    news:1159334679 .095427.9430@i4 2g2000cwa.googl egroups.com...
    Hi,
    >
    I uploaded the following file to my site:
    >
    <?php
    header("Content-type: text/plain");
    >
    echo "latex is at: ";
    system("which latex");
    >
    echo "ls is at: ";
    system("which ls");
    >
    echo "convert is at: ";
    system("which convert");
    >
    echo "gs is at: ";
    system("which gs");
    >
    ?>
    >
    and none of the paths are being printed out, only the echo statements
    are... I would think atleast ls should show up? Execute permissions
    have been given to it too.

    Are system/exec/passthru allowed on your php? Do you get any output from any
    command, say ls or uptime or something else rather trivial?

    Also try something like this for debugging:

    $output = system('ls', $return_val)
    var_dump($outpu t); // This will be boolean false on failure
    var_dump($retur n_val); // This will contain the return status of the command


    --
    "Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
    http://outolempi.net/ahdistus/ - Satunnaisesti päivittyvä nettisarjis
    spam@outolempi. net || Gedoon-S @ IRCnet || rot13(xvzzb@bhg byrzcv.arg)


    Comment

    • yusuf

      #3
      Re: why is which not working?

      Also try something like this for debugging:
      >
      $output = system('ls', $return_val)
      var_dump($outpu t); // This will be boolean false on failure
      var_dump($retur n_val); // This will contain the return status of the command
      They are printing out:

      NULL
      NULL

      thanks.

      Comment

      • Kimmo Laine

        #4
        Re: why is which not working?

        "yusuf" <yusufm@gmail.c omwrote in message
        news:1159340135 .258673.299180@ e3g2000cwe.goog legroups.com...
        >Also try something like this for debugging:
        >>
        >$output = system('ls', $return_val)
        >var_dump($outp ut); // This will be boolean false on failure
        >var_dump($retu rn_val); // This will contain the return status of the
        >command
        >
        They are printing out:
        >
        NULL
        NULL

        Huh, it would seem like system function is disabled, since it returns
        absolutely nothing. It's a configuration issue, so which propably works just
        fine, php just can't access it cos it's not allowed.

        --
        "Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
        http://outolempi.net/ahdistus/ - Satunnaisesti päivittyvä nettisarjis
        spam@outolempi. net || Gedoon-S @ IRCnet || rot13(xvzzb@bhg byrzcv.arg)


        Comment

        Working...