Results 1 to 5 of 5

Thread: PHP Script - Failed to Open Stream

  1. #1
    Join Date
    Jul 2008
    Location
    USA
    Posts
    12
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question PHP Script - Failed to Open Stream

    Hello,

    I have a web page which people can post their messages on it. Now for some reasons, the script has errors, and it cannot open stream... Here is the error message:

    Warning: fopen(data/) [function.fopen]: failed to open stream: Is a directory in /homepages/33/d138037059/htdocs/wish/show.php on line 21

    Warning: flock() expects parameter 1 to be resource, boolean given in /homepages/33/d138037059/htdocs/wish/show.php on line 22

    Warning: fclose(): supplied argument is not a valid stream resource in /homepages/33/d138037059/htdocs/wish/show.php on line 24
    ...


    Here is the URL: http://www.uswebcity.com/wish/show.p...ber=1237725546 (errors)

    Here is the web page: http://www.uswebcity.com/wish/

    The script did work fine before last month and I have not made any changes. I know the script(s) has no errors, and it will not cause any errors because today I did try the same(identical) scripts at other website that host by StartLogic.com host company, and the script works fine there. So the errors which are at my web site may cause by my current host company's server settings or some php configurations.

    Could you please help me to fix(change) the script? So it will work fine with (both) my current host company(oneandone.com).
    Here is part of the script that the errors refer to:

    PHP Code:
    <?
    include "config.inc";

    $f=file("data/$number");
    for(
    $i=0$i<count($f); $i++){
    if(
    $i== 8)$f[$i]=$f[$i]+1;
    $message=$message.$f[$i];
    $ff=explode("\n",$f[$i]);
    $f[$i]=$ff[0];
    }
    $fp=fopen("data/$number","w");   ### Line # 21
    flock($fp,3);
    fwrite($fp,$message);
    fclose($fp);
    ?>

    Thanks.

    Andy
    __________________
    Make A New Website --- USWebCity.com
    >> Web Hosting Ratings and Reviews <<
    Last edited by andy8828; 09-11-2009 at 08:56 PM.

  2. #2
    Join Date
    Jul 2008
    Location
    USA
    Posts
    12
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    After I defined the $number, the errors were fixed now.
    $number = (int)$_GET['number'];

    But I have one more question. When I click on the the link below which it should open a new submit form window for people to fill it out. But now it only reloads the current page. The submit form does not show up.

    PHP Code:
    <?
    if($do=='new'){
    ?>
    Here is the URL: http://www.uswebcity.com/wish/wish.php?do=new

    Thanks.

  3. #3
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    When I visit the link you posted, it seems to be working fine. Could you be more specific with your problem?
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  4. #4
    Join Date
    Jul 2008
    Location
    USA
    Posts
    12
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Exclamation

    After I changed it to

    PHP Code:
    if($_GET['do']=='new'){ 
    The submit form shows up on the web site. But after I filled out the form and submited it, I don't get any data from the form. I don't see it created any data files in my web server DATA directory. Do you have anymoe suggestion?

    Also, you can find part of the script. Thanks.

  5. #5
    Join Date
    Jul 2008
    Location
    USA
    Posts
    12
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    After I tuned on the php setting "register_globals = on", the form works fine now.

    http://www.uswebcity.com/wish/wish.php

    Thank you very much for your help.

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
  •