Host says "Check php include path"

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Gutspiller
    New Member
    • Apr 2010
    • 8

    #1

    Host says "Check php include path"

    I am new here (Hello!), I am trying to fix a problem that some of the pages of my site are displaying the following error:

    Warning: getimagesize(./swf/FWG Bridge_july_4th _2008.swf ) [function.getima gesize]: failed to open stream: No such file or directory in /home/games4w/public_html/games/system.class.ph p on line 430

    The thing is some pages aren't.

    On the pages that display the error, it's not loading up my content either (flash games).

    I talked to my host about this and they said "Please update the programmer to check the php include path in the scripts."

    I'm hoping I might be able to get some help in resolving the problem without paying a php programmer, as it sounds like it might just be a line of code that contains a path incorrectly.

    The above mentioned error notes line 430 in system.class.ph p, here is line 430 of that file:

    list($imagewidt h, $imageheight, $itype, $iattr, $imime) = getimagesize($t his->swfdir."/".$game['game_swf']);

    I already know some people have "claimed" that getimagesize only works with images, but I guess it doesn't because other flash games on the site work just fine, and getimagesize does fine the correct proportions to the games.

    Can anybody please help? I am not a php programmer, but I can follow any directions of copying lines of code here, or replacing certain ones. Any help would be appreciated.

    Thank you!
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hey!

    Looks like there might be an extra space there, after the name of the SWF file.
    Try replacing the line with these two:
    [code=php]
    $swfPath = $this->swfdir . '/' . trim($game['game_swf']);
    list($imagewidt h, $imageheight, $itype, $iattr, $imime) = getimagesize($s wfPath);[/code]

    Comment

    • Gutspiller
      New Member
      • Apr 2010
      • 8

      #3
      Amazing. Thank you very much. You saved me from having to hire a programmer to fix this small little error.

      Quick, and accurate. I think I found a new php help forum. :)

      Comment

      • Gutspiller
        New Member
        • Apr 2010
        • 8

        #4
        Hmm, looking at more game pages, it appears that didn't solve all the issues. I found out that now other pages display the error still, but this time it says line 431, which is this:

        list($imagewidt h, $imageheight, $itype, $iattr, $imime) = getimagesize($s wfPath);

        Any ideas?

        Comment

        • Atli
          Recognized Expert Expert
          • Nov 2006
          • 5062

          #5
          Ok, past the error here exactly like it appears on the page. (Within [code] tags, preferably, so we can see all the white-spaces.)

          Comment

          • Gutspiller
            New Member
            • Apr 2010
            • 8

            #6
            The error:
            Code:
            Warning: getimagesize(./swf/Climb or Drown_april_7th_2010.swf) [function.getimagesize]: failed to open stream: No such file or directory in /home/games4w/public_html/games/system.class.php  on line 431



            Line 430 and 431 of my actual code:
            Code:
                        $swfPath = $this->swfdir . '/' . trim($game['game_swf']);
            			list($imagewidth, $imageheight, $itype, $iattr, $imime) = getimagesize($swfPath);

            Thanks for any more help!

            Comment

            • Markus
              Recognized Expert Expert
              • Jun 2007
              • 6092

              #7
              Hi, Gutspiller (lovely name :P)

              Why don't you find out what the full path is resolving to:
              Code:
              print realpath($swfPath);
              You'll then see if this path looks valid or not.

              Comment

              • Gutspiller
                New Member
                • Apr 2010
                • 8

                #8
                Originally posted by Markus
                Hi, Gutspiller (lovely name :P)

                Why don't you find out what the full path is resolving to:
                Code:
                print realpath($swfPath);
                You'll then see if this path looks valid or not.
                I put that in right under line 431, and on the game pages that give errors, it didn't display anything new, but on pages that work and display the games just fine I got this:

                Code:
                /home/games4w/public_html/games/swf/Truffle Hunter_april_21st_2010.swf
                That path to the game does exist, and looks right, but so do the paths to the files that give errors too.

                Comment

                • Atli
                  Recognized Expert Expert
                  • Nov 2006
                  • 5062

                  #9
                  The realpath function should return a file path on all the pages. The only reason for it not to return a path is if that file doesn't exists or is inaccessible.

                  Do this, and show us the output (from the source):
                  [code=php]$swfPath = $this->swfdir . '/' . trim($game['game_swf']);
                  echo "<pre>", var_dump($swfPa th), var_dump(realpa th($swfPath)), "</pre>";
                  list($imagewidt h, $imageheight, $itype, $iattr, $imime) = getimagesize($s wfPath);[/code]

                  Also, make sure the file has proper permissions, so that PHP can access it.

                  Comment

                  • Gutspiller
                    New Member
                    • Apr 2010
                    • 8

                    #10
                    I have discovered more of a problem then I ever thought possible... but I still need help.

                    After doing more research and talking with my host, here is what's happening.

                    To publish games I upload their game file (.swf) and their thumbnail to the server. While doing this I manually add a date to the file. For example:

                    Home Sheep Home_february_2 6th_2010.swf

                    and

                    Home-Sheep-Home_february_2 6th_2010.jpg

                    Everything is fine so far, and these files exist on the server in their proper folders, but here's where something strange happens.

                    The error on the page that is attempt to call this flash game is this:

                    Warning: getimagesize(./swf/Home Sheep Home_february_2 5th_2010.swf) [function.getima gesize]: failed to open stream: No such file or directory in /home/games4w/public_html/games/system.class.ph p on line 431

                    If you don't see it, the error has the date in the .swf file as _february_25th_ 2010.swf while the actual date in the filename is _february_26th_ 2010.swf

                    Perhaps somebody can shed some light on how this is happening, and how to fix it?

                    I have one theory, a month or so ago, I hired a programmer to add a caching system to our site.

                    Is it possible, that he saw these dates on the files that needed to be cached, and thought that they were generated automatically by the date of the server?

                    If this is possible, then is it possible for you php coders to give me some hints of commands that he may have had to use in my files, that I might be able to search for so I could take it out, or even better, so I could paste the suspected code snippets here, and you tell me if it's doing what I have my theory about?

                    Please help! I desperately need to fix this problem, and am hoping that I don't have to go back and fix all the entries in my database if it's permanently changing all these dates.

                    Comment

                    • Gutspiller
                      New Member
                      • Apr 2010
                      • 8

                      #11
                      Originally posted by Atli
                      The realpath function should return a file path on all the pages. The only reason for it not to return a path is if that file doesn't exists or is inaccessible.

                      Do this, and show us the output (from the source):
                      [code=php]$swfPath = $this->swfdir . '/' . trim($game['game_swf']);
                      echo "<pre>", var_dump($swfPa th), var_dump(realpa th($swfPath)), "</pre>";
                      list($imagewidt h, $imageheight, $itype, $iattr, $imime) = getimagesize($s wfPath);[/code]

                      Also, make sure the file has proper permissions, so that PHP can access it.
                      When i added that code in replacement of the other 2 lines I get this at the top of the page:

                      string(41) "./swf/Da Vinci Cannon_march_28 th_2010.swf"
                      bool(false)


                      Warning: getimagesize(./swf/Da Vinci Cannon_march_28 th_2010.swf) [function.getima gesize]: failed to open stream: No such file or directory in /home/games4w/public_html/games/system.class.ph p on line 434

                      A different game page, but still one that was giving the same error as the others I've mentioned.

                      Does this give you any ideas?

                      Comment

                      • Atli
                        Recognized Expert Expert
                        • Nov 2006
                        • 5062

                        #12
                        Ok, so the filename is invalid.

                        Can you show us where the $game['game_swf'] variable in your code is defined; where the $game array is set.

                        If there is a problem with the dates; that the caching feature is using the incorrect date, then you need to alter the code that does that to use the "static" date instead. - But to do that you need to find the code that fetches the real date and the code that creates the $game['game_swf'] value.

                        Comment

                        • Gutspiller
                          New Member
                          • Apr 2010
                          • 8

                          #13
                          line 411
                          Code:
                                  $content->set('game_swf',$this->swfdir."/".$game['game_swf']);
                          413
                          Code:
                          $games_swf = $game['game_swf'];
                          416
                          Code:
                          $content->set('game_swf2',$this->swfdir2."/".$game['game_swf']);
                          430/431 - (The ones I've been posting)
                          Code:
                                      $swfPath = $this->swfdir . '/' . trim($game['game_swf']);
                          			list($imagewidth, $imageheight, $itype, $iattr, $imime) = getimagesize($swfPath);
                          Those are all the lines in my system.class.ph p file that contain $game['game_swf']. Searching all the files for my site, and $game['game_swf'] doesn't appear in any other files.

                          As far as finding the code that is changing the date, do you have any ideas on words to search for? That, or maybe if you are still willing, I could attach my system.class.ph p to a PM? I am sorta thinking it's somewhere in there.

                          Comment

                          Working...