PHP 4.3.4.4

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

    #1

    PHP 4.3.4.4

    I am new to all this testing server terminolgy. For the last 6 days I have
    read everything I can find on installing php/mysql, IIS as a testing server.

    IIS, MySQL, PHP installed and apparently working but since I have never had
    any experience with any of them I can't be sure.

    WinXP Pro
    IIS
    PHP 4.3.4.4

    I am on chapter 2 of Welling and Thompson PHP and MySQL book which is for an
    earlier version of php.

    Once I discovered this I was able to change some of the ini settings to get
    it working.

    There are two pages I am working with entered as called for in the book:
    orderform.htm and processorder.ph p

    The submit buttom calls the processorder.ph p and executes the php
    statements, sets the variables, echo to the screen preforms calucations
    etc., until I get to the fopen() function and I get the message below.

    Warning: fopen(http://localhost/phptest/orderfile/orders.txt): failed to
    open stream: HTTP wrapper does not support writeable connections. in
    c:\inetpub\wwwr oot\phptest\pro cessorder.php on line 56

    Warning: flock(): supplied argument is not a valid stream resource in
    c:\inetpub\wwwr oot\phptest\pro cessorder.php on line 57

    Your order could not be processed at this time. Please try again later.

    The relevant code section:

    $outputstring = $date."\t".$tyr eqty." tyres \t".$oilqty." oil\t"
    .$sparkqty." spark plugs\t\$".$tot al
    ."\t". $address."\n";

    // open file for appending
    $fp = fopen("http://localhost/phptest/orderfile/orders.txt", "a+");


    flock($fp, 2);
    {
    echo "<p><strong > Your order could not be processed at this time. "
    ."Please try again later.</strong></p></body></html>";
    exit;
    }

    fwrite($fp, $outputstring);
    flock($fp, 3);
    fclose($fp);

    echo "<p>Order written.</p>";

    ?>

    In the IIS console I selected the phptest/orderfile folder and checked read
    and write.

    I have read the help on stream and it makes no sense to me at all.

    I am totally frustrated at this point. I have been going around in circles
    and am no closer to getting the problem soved than I was 6 days ago.

    Any advice, suggestions, links etc will be greatly appreciated.

    Bert




  • Eric Bohlman

    #2
    Re: PHP 4.3.4.4

    "Bert" <bert_remove@me ckcom.net> wrote in
    news:fNB8c.1934 $pp4.367@fe07.u senetserver.com :
    [color=blue]
    > Warning: fopen(http://localhost/phptest/orderfile/orders.txt): failed
    > to open stream: HTTP wrapper does not support writeable connections.
    > in c:\inetpub\wwwr oot\phptest\pro cessorder.php on line 56[/color]

    That's because you weren't actually opening a file there; you were asking
    your Web server to fetch a resource and return its contents to you. You
    need to specify a filesystem path, not a URL, and not specify a protocol.
    [color=blue]
    > Warning: flock(): supplied argument is not a valid stream resource in
    > c:\inetpub\wwwr oot\phptest\pro cessorder.php on line 57[/color]

    That's because your fopen() failed, so the result it returned wasn't a
    valid file handle.

    Comment

    • Bert

      #3
      Re: PHP 4.3.4.4

      Hi Eric,

      Any possibility you could provide sample code for the fopen() call?

      Bert

      "Eric Bohlman" <ebohlman@earth link.net> wrote in message
      news:Xns94B755C B125E1ebohlmano msdevcom@130.13 3.1.4...[color=blue]
      > "Bert" <bert_remove@me ckcom.net> wrote in
      > news:fNB8c.1934 $pp4.367@fe07.u senetserver.com :
      >[color=green]
      > > Warning: fopen(http://localhost/phptest/orderfile/orders.txt): failed
      > > to open stream: HTTP wrapper does not support writeable connections.
      > > in c:\inetpub\wwwr oot\phptest\pro cessorder.php on line 56[/color]
      >
      > That's because you weren't actually opening a file there; you were asking
      > your Web server to fetch a resource and return its contents to you. You
      > need to specify a filesystem path, not a URL, and not specify a protocol.
      >[color=green]
      > > Warning: flock(): supplied argument is not a valid stream resource in
      > > c:\inetpub\wwwr oot\phptest\pro cessorder.php on line 57[/color]
      >
      > That's because your fopen() failed, so the result it returned wasn't a
      > valid file handle.[/color]



      Comment

      • Eric Bohlman

        #4
        Re: PHP 4.3.4.4

        "Bert" <bert_remove@me ckcom.net> wrote in
        news:0kC8c.1935 $pp4.45@fe07.us enetserver.com:
        [color=blue]
        > "Eric Bohlman" <ebohlman@earth link.net> wrote in message
        > news:Xns94B755C B125E1ebohlmano msdevcom@130.13 3.1.4...[color=green]
        >> "Bert" <bert_remove@me ckcom.net> wrote in
        >> news:fNB8c.1934 $pp4.367@fe07.u senetserver.com :
        >>[color=darkred]
        >> > Warning: fopen(http://localhost/phptest/orderfile/orders.txt):
        >> > failed to open stream: HTTP wrapper does not support writeable
        >> > connections. in c:\inetpub\wwwr oot\phptest\pro cessorder.php on line
        >> > 56[/color]
        >>
        >> That's because you weren't actually opening a file there; you were
        >> asking your Web server to fetch a resource and return its contents to
        >> you. You need to specify a filesystem path, not a URL, and not
        >> specify a protocol.[/color][/color]
        [color=blue]
        > Hi Eric,
        >
        > Any possibility you could provide sample code for the fopen() call?[/color]

        No, because I have no idea where in your filesystem "orders.txt " is being
        stored; there's *no* necessary relation between a URL path and a filesystem
        path. Take the actual filesystem path and put it (enclosed in quotes) in
        your fopen call in place of the stuff that starts with "http".

        Comment

        • Bert

          #5
          Re: PHP 4.3.4.4

          Eric,

          Thanks a million. You have made my day.

          I knew it had to be something simple but had no idea what I was doing wrong.

          You don't know how much I appreciate you and the others that help us dummies
          out.

          Thanks again,

          Bert


          "Eric Bohlman" <ebohlman@earth link.net> wrote in message
          news:Xns94B7601 FB2610ebohlmano msdevcom@130.13 3.1.4...[color=blue]
          > "Bert" <bert_remove@me ckcom.net> wrote in
          > news:0kC8c.1935 $pp4.45@fe07.us enetserver.com:
          >[color=green]
          > > "Eric Bohlman" <ebohlman@earth link.net> wrote in message
          > > news:Xns94B755C B125E1ebohlmano msdevcom@130.13 3.1.4...[color=darkred]
          > >> "Bert" <bert_remove@me ckcom.net> wrote in
          > >> news:fNB8c.1934 $pp4.367@fe07.u senetserver.com :
          > >>
          > >> > Warning: fopen(http://localhost/phptest/orderfile/orders.txt):
          > >> > failed to open stream: HTTP wrapper does not support writeable
          > >> > connections. in c:\inetpub\wwwr oot\phptest\pro cessorder.php on line
          > >> > 56
          > >>
          > >> That's because you weren't actually opening a file there; you were
          > >> asking your Web server to fetch a resource and return its contents to
          > >> you. You need to specify a filesystem path, not a URL, and not
          > >> specify a protocol.[/color][/color]
          >[color=green]
          > > Hi Eric,
          > >
          > > Any possibility you could provide sample code for the fopen() call?[/color]
          >
          > No, because I have no idea where in your filesystem "orders.txt " is being
          > stored; there's *no* necessary relation between a URL path and a[/color]
          filesystem[color=blue]
          > path. Take the actual filesystem path and put it (enclosed in quotes) in
          > your fopen call in place of the stuff that starts with "http".
          >[/color]



          Comment

          Working...