invoking php?

Discussion in 'C Programming' started by Bush is a Fascist, Jul 21, 2005.

  1. Hi all,

    Nobody in the php forum seems to know how to invoke
    php properly from C, so I must ask here.

    I am doing is the following, which seems to be by the book,
    but then again I am finding very few explanations
    on the subject.

    setenv ("REQUEST_METHOD", "GET", !0);
    setenv ("QUERY_STRING", "abc=123", !0);
    system "/usr/local/bin/php myfile.php < dummyfile > foo";

    Dummyfile can be empty or have data in it, yet
    I keep getting an error:

    "No input file specified."

    Anybody know what's going on?

    Thanks.
    333
     
    Bush is a Fascist, Jul 21, 2005
    #1
    1. Advertisements

  2. Bush is a Fascist

    SM Ryan Guest

    SM Ryan, Jul 21, 2005
    #2
    1. Advertisements

  3. Bush is a Fascist

    CBFalconer Guest

    On the contrary, you must NOT ask known off-topic questions here.
     
    CBFalconer, Jul 21, 2005
    #3
  4. Who lit your tampon? Go be prissy somewhere else.
     
    Bush is a Fascist, Jul 22, 2005
    #4
  5. Bush is a Fascist

    Sensei Guest

    He is *totally* right:

    setenv ("REQUEST_METHOD", "GET", !0);
    setenv ("QUERY_STRING", "abc=123", !0);
    system "/usr/local/bin/php myfile.php < dummyfile > foo";
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    The line is NOT written in C, and the others can be written in another
    language as well.

    You'd better stick with PHP related newsgroups.
     
    Sensei, Jul 22, 2005
    #5
  6. Bush is a Fascist

    Red Guest

    People who post orders like that make me want to post OT material here
    just to piss them off.
     
    Red, Jul 22, 2005
    #6
  7. Bush is a Fascist

    CBFalconer Guest

    PLONK. Enjoy.
     
    CBFalconer, Jul 22, 2005
    #7
  8. Me too. What is the airspeed of an unladen sparrow?

    Chris C
     
    Chris Croughton, Jul 22, 2005
    #8
  9. Bush is a Fascist

    SM Ryan Guest

    # On Fri, 22 Jul 2005 00:42:47 -0400, Red
    #
    # > In article <>, says...
    # >> Bush is a Fascist wrote:
    # >> >
    # >> > Nobody in the php forum seems to know how to invoke
    # >> > php properly from C, so I must ask here.
    # >>
    # >> On the contrary, you must NOT ask known off-topic questions here.
    # >
    # > People who post orders like that make me want to post OT material here
    # > just to piss them off.
    #
    # Me too. What is the airspeed of an unladen sparrow?

    http://www.garden-birds.co.uk/information/flight.htm

    17 to 24 mph.
     
    SM Ryan, Jul 22, 2005
    #9
  10. Bush is a Fascist

    Default User Guest

    *plonk*




    Brian
     
    Default User, Jul 22, 2005
    #10
  11. Bush is a Fascist

    Alan Balmer Guest

    You're just trying to butter up Chuck with your pen name.
     
    Alan Balmer, Jul 22, 2005
    #11
  12. This topic came up last year. You've repeated (deliberately?) the
    error made back then; the original question was about an unladen
    *swallow*.

    The answer is about 60 to 66 kilofurlongs per fortnight.

    CBFalconer's original answer of 27 kilofurlongs per fortnight may have
    been about right for sparrows.
     
    Keith Thompson, Jul 22, 2005
    #12
  13. Interesting, that's the answer I got (for a house-sparrow,
    hedge-sparrows are smaller which may make a difference). I measured it
    in a car chasing the bird down a lane...

    (The answer should, of course, have been a question about what sort of
    sparrow I meant, at which point I would vanish in a puff of smoke...)

    Chris C
     
    Chris Croughton, Jul 22, 2005
    #13
  14. I do know the original, very well, my question was about a different
    bird (it seems that my measurements of "20 MPH give or take a bit" were
    correct according to the posted link).
    African or European?
    No, it's much too slow. They are slower than swallows on average, but
    they still achieve around 45 to 60 kilofurlongs/fortnight (a unit with
    which I am more familiar as furlongs per millifortnight)...

    Chris C
     
    Chris Croughton, Jul 22, 2005
    #14
  15. Rotate upon it, idiot.
     
    Mark McIntyre, Jul 22, 2005
    #15
  16. I'm sorry, this sketch has become far too silly. I demand that you
    perform the Fish Dance at once.
     
    Mark McIntyre, Jul 22, 2005
    #16
  17. Bush is a Fascist

    Default User Guest

    Mark, I'd ask you not get into name-calling matches with people that
    many of us kill-filed long ago.




    Brian
     
    Default User, Jul 22, 2005
    #17
  18. Albatross!

    (The speed of light is 1 foot per nanosecond, as a first approximation.
    Far more useful than the more accurate 186282.4 miles per second...)

    What's the silly unit managers like to use to measure programming
    productivity? Lines of code per man-week or something?

    Chris C
     
    Chris Croughton, Jul 23, 2005
    #18
  19. Bush is a Fascist

    Steve Summit Guest

    Gad, that's clumsy! I hate stuffing parameters through the
    environment like that! (Not your fault, of course. It's bad
    enough from the shell -- see below -- but somehow it seems even
    worse in C, with those explicit setenv calls.)

    I'd recommend replacing those "!0" thingies with "1" or "TRUE",
    though -- rederiving the value of "true" on-the-fly in this way
    strikes me as obfuscatory.
    I assume you mean

    system("/usr/local/bin/php myfile.php < dummyfile > foo");

    (But if not, that may be your problem right there.)

    I suspect you'll eventually want to stuff the input into php by
    invoking it with popen(), not system().
    No, not yet. What happens if you bypass C entirely and invoke

    REQUEST_METHOD=GET QUERY_STRING=abc=123 /usr/local/bin/php myfile.php < dummyfile

    directly from the shell command line?

    Steve Summit
     
    Steve Summit, Jul 24, 2005
    #19
  20. Bush is a Fascist

    Richard Bos Guest

    That's the Fish _Slapping_ Dance, you snotty-faced heap of parrot
    droppings!

    Oh, I'm sorry, this isn't comp.lang.abuse.

    Richard
     
    Richard Bos, Jul 25, 2005
    #20
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.