Professional Web Applications Themes

[PHP] executing shell commands. - PHP Development

I am executing the following within PHP - $system = `/bin/ls /dcsa-ws1/share/webadm1/public_html/system-reports/security/rhosts/eqty | /bin/egrep -v "server|header|index|report|php|old|title" | /bin/head -$x | /bin/tail -1 | /bin/awk '{ print $1 }'` ; $numlin = `/bin/cat /dcsa-ws1/share/webadm1/public_html/system-reports/security/rhosts/eqty/$system | /bin/wc -l` ; The first line resolves correctly for the system name. The $numlin does not appear to resolve correctly - appears to be an issues with passing the $system variable in the the second line. Any ideas. Any feedback will be appreciated. Thanks. Samir....

  1. #1

    Default [PHP] executing shell commands.


    I am executing the following within PHP -

    $system = `/bin/ls /dcsa-ws1/share/webadm1/public_html/system-reports/security/rhosts/eqty | /bin/egrep -v "server|header|index|report|php|old|title" | /bin/head -$x | /bin/tail
    -1 | /bin/awk '{ print $1 }'` ;

    $numlin = `/bin/cat /dcsa-ws1/share/webadm1/public_html/system-reports/security/rhosts/eqty/$system | /bin/wc -l` ;


    The first line resolves correctly for the system name.

    The $numlin does not appear to resolve correctly - appears to be an issues with passing the
    $system variable in the the second line. Any ideas. Any feedback will be appreciated. Thanks.

    Samir.
    Samir Sethi Guest

  2. #2

    Default Re: [PHP] executing shell commands.

    Hi!

    I'm not sure this could be your problem, but this is
    what I see:

    $numlin = '/bin/cat
    /dcsa-ws1/share/webadm1/public_html/system-reports/security/rhosts/eqty/$system
    | /bin/wc -l';

    I think you should write it like this:

    $numlin = "/bin/cat
    /dcsa-ws1/share/webadm1/public_html/system-reports/security/rhosts/eqty/$system
    | /bin/wc -l";

    I had this kind of problem once and my script wasn't
    replacing the variable ($system). It was just writing
    $system in the string.

    Hope this helps.

    Regards, Douglas.

    __________________________________
    Do you Yahoo!?
    Yahoo! SiteBuilder - Free, easy-to-use web site design software
    [url]http://sitebuilder.[/url]
    Douglas Douglas Guest

  3. #3

    Default Re: [PHP] executing shell commands.

    * Thus wrote Sethi, Samir (IDS DM&DS) (samir_sethiml.com):
    >
    > I am executing the following within PHP -
    >
    > $system = `/bin/ls /dcsa-ws1/share/webadm1/public_html/system-reports/security/rhosts/eqty | /bin/egrep -v "server|header|index|report|php|old|title" | /bin/head -$x | /bin/tail
    > -1 | /bin/awk '{ print $1 }'` ;
    >
    > $numlin = `/bin/cat /dcsa-ws1/share/webadm1/public_html/system-reports/security/rhosts/eqty/$system | /bin/wc -l` ;
    Any reason your cat'ing the file instead of just runing

    /bin/wc -l file


    also, what is the contents of $system? the backticks will expand
    variables, my guess is that the first command isn't returning what
    you expected.

    Curt
    --
    "I used to think I was indecisive, but now I'm not so sure."
    Curt Zirzow Guest

  4. #4

    Default RE: [PHP] executing shell commands.


    This seems to do the trick -

    $system = `/bin/ls /dcsa-ws1/share/webadm1/public_html/system-reports/security/rhosts/
    eqty | /bin/egrep -v "server|header|index|report|php|old|title" | /bin/head -$x | /b
    in/tail -1 | /bin/awk '{ print $1 }'` ;

    $numlin = `/bin/wc -l /dcsa-ws1/share/webadm1/public_html/system-reports/security/rhos
    ts/eqty/$system` ;

    Thanks.

    Samir.


    -----Original Message-----
    From: Curt Zirzow [mailto:php-generalzirzow.dyndns.org]
    Sent: Wednesday, September 10, 2003 12:15 PM
    To: 'php-generallists.php.net'
    Subject: Re: [PHP] executing shell commands.


    * Thus wrote Sethi, Samir (IDS DM&DS) (samir_sethiml.com):
    >
    > I am executing the following within PHP -
    >
    > $system = `/bin/ls /dcsa-ws1/share/webadm1/public_html/system-reports/security/rhosts/eqty | /bin/egrep -v "server|header|index|report|php|old|title" | /bin/head -$x | /bin/tail
    > -1 | /bin/awk '{ print $1 }'` ;
    >
    > $numlin = `/bin/cat /dcsa-ws1/share/webadm1/public_html/system-reports/security/rhosts/eqty/$system | /bin/wc -l` ;
    Any reason your cat'ing the file instead of just runing

    /bin/wc -l file


    also, what is the contents of $system? the backticks will expand
    variables, my guess is that the first command isn't returning what
    you expected.

    Curt
    --
    "I used to think I was indecisive, but now I'm not so sure."

    --
    PHP General Mailing List (http://www.php.net/)
    To unsubscribe, visit: http://www.php.net/unsub.php
    Samir Sethi Guest

  5. #5

    Default Upload seems to time out over 7.5 M

    Hello all,

    I couldn't upload any files larger than 2M. So I searched around and found
    this post last night and I made the changes to the php.ini file to support
    20M file uploads. The changes were successful but just like in the post
    below I can't upload over a 7.5M file now. Any ideas would be much
    appreciated.

    Thanks,
    Lou
    Lou Parmelee Guest

  6. #6

    Default Re: [PHP] Upload seems to time out over 7.5 M

    try: set_time_limit(0); // don't time out.

    By default, if it takes more then 30 seconds (or is it 60?) to execute a
    web page PHP kills the script.

    -Dan

    On Wed, 2003-09-10 at 14:15, Lou Parmelee wrote:
    > Hello all,
    >
    > I couldn't upload any files larger than 2M. So I searched around and found
    > this post last night and I made the changes to the php.ini file to support
    > 20M file uploads. The changes were successful but just like in the post
    > below I can't upload over a 7.5M file now. Any ideas would be much
    > appreciated.
    >
    > Thanks,
    > Lou
    Dan Anderson Guest

  7. #7

    Default RE: [PHP] Upload seems to time out over 7.5 M

    In the php.ini file set this value?

    Thanks,
    Lou

    -----Original Message-----
    From: Dan Anderson [mailto:danmathjunkies.com]
    Sent: Wednesday, September 10, 2003 2:18 PM
    To: [email]louexperiencethemedia.com[/email]
    Cc: 'Php-GeneralLists. Php. Net'
    Subject: Re: [PHP] Upload seems to time out over 7.5 M

    try: set_time_limit(0); // don't time out.

    By default, if it takes more then 30 seconds (or is it 60?) to execute a
    web page PHP kills the script.

    -Dan

    On Wed, 2003-09-10 at 14:15, Lou Parmelee wrote:
    > Hello all,
    >
    > I couldn't upload any files larger than 2M. So I searched around and found
    > this post last night and I made the changes to the php.ini file to support
    > 20M file uploads. The changes were successful but just like in the post
    > below I can't upload over a 7.5M file now. Any ideas would be much
    > appreciated.
    >
    > Thanks,
    > Lou
    Lou Parmelee Guest

  8. #8

    Default Re: [PHP] Upload seems to time out over 7.5 M

    set_time_limit() takes effect only during actual execution of php script.

    Take a look at your max_input_time and post_max_size settings.
    post_max_size should be higher than upload_max_filesize.

    Dan Anderson wrote:
    > try: set_time_limit(0); // don't time out.
    >
    > By default, if it takes more then 30 seconds (or is it 60?) to execute a
    > web page PHP kills the script.
    >
    > -Dan
    >
    > On Wed, 2003-09-10 at 14:15, Lou Parmelee wrote:
    >
    >>Hello all,
    >>
    >>I couldn't upload any files larger than 2M. So I searched around and found
    >>this post last night and I made the changes to the php.ini file to support
    >>20M file uploads. The changes were successful but just like in the post
    >>below I can't upload over a 7.5M file now. Any ideas would be much
    >>appreciated.
    >>
    >>Thanks,
    >>Lou
    >
    >
    Marek Kilimajer Guest

Similar Threads

  1. shell repeat commands
    By yls177 in forum Linux / Unix Administration
    Replies: 2
    Last Post: January 26th, 03:47 AM
  2. Windows Shell Commands
    By Boris \BXS\ Schulz in forum Ruby
    Replies: 3
    Last Post: November 10th, 08:45 AM
  3. How do I escape shell commands?
    By Dan Anderson in forum PERL Beginners
    Replies: 5
    Last Post: October 15th, 09:01 PM
  4. executing multiple shell commands via one exec()-call
    By Falk Schneider in forum PHP Development
    Replies: 1
    Last Post: July 15th, 06:20 AM
  5. Shell commands in ASP.NET?
    By Allan Rojas in forum ASP.NET General
    Replies: 3
    Last Post: July 3rd, 05:29 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139