SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Zealot
    Join Date
    Apr 2005
    Location
    Helsingborg, Sweden
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problems when including.

    Trying to add some database driven material to a site created with some stupid MS WYSIWYG thingy.
    Anyway, those new pages I created myself works fine but when trying to remake an existing html file with some php function I fall flat.
    just taking an existing .htm renaming it to .php and adding these lines at the top makes the page fail.
    PHP Code:
    <?php
    include "temp.php";
    ?>
    Even if temp.php is an empty file it fails. Another thing that makes this problem even harder is that this particular webhost seems to have shut off all error reporting and I havn't been able to change that. If I comment out the include line the file loads fine but with it it won't. Those pages I constructed myself includes files in just this manner and they work fine. Anyone with a clue?

  2. #2
    SitePoint Enthusiast
    Join Date
    Jan 2006
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It should be like this...
    Code:
    <?php
    include ("temp.php");
    ?>

  3. #3
    SitePoint Zealot
    Join Date
    Apr 2005
    Location
    Helsingborg, Sweden
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by HighCaliber
    It should be like this...
    Code:
    <?php
    include ("temp.php");
    ?>
    Hmm I just said that I had done the including in the way I described before in my other docs and that worked. But anyway, I gave your way a try HighCaliber and it didn't help. But thanks for trying.

  4. #4
    SitePoint Zealot agoossens's Avatar
    Join Date
    Mar 2004
    Location
    Adelaide, Australia
    Posts
    124
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    When include searches for files it looks in two places: first, in include_path relative to your working directory and second, in include_path relative to directory where the include()'ing script is located.

    I suggest you read the manual page on include() or require() for a more thorough explanation, and a couple of examples.

    By the way:
    PHP Code:
    error_reporting(E_ALL);
    ini_set('display_errors''on'); 
    This space for rent.

  5. #5
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sounds like a permissions issue. but once you get error reporting turned on youll know for sure.

  6. #6
    SitePoint Zealot
    Join Date
    Apr 2005
    Location
    Helsingborg, Sweden
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I can't turn on error reporting, tried it before and tried it again with exactly what agoossens wrote, still nothing. I don't know how the webhost set up the server. But other files that I have created and that are in the root directory (as is the file I'm having problems with) can import files without a problem. The only differens between the document is that I didn't originally create the file which is causing problems though I've changed it and reloaded it to the server.

  7. #7
    SitePoint Zealot
    Join Date
    Apr 2005
    Location
    Helsingborg, Sweden
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It seem now like any php command will cause the page to fail.
    PHP Code:
    <?php
    /*error_reporting(E_ALL);
    ini_set('display_errors', 'on');
    include ("temp.php");*/
    ?>
    This let's the page load but making any of the above lines valid code makes the page fail. This is becoming annoying...

  8. #8
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    maybe your file is corrupt or a bad invisible character made its way in.

    delete the file, start fresh. type it by hand, dont cut and paste.

  9. #9
    SitePoint Zealot
    Join Date
    Apr 2005
    Location
    Helsingborg, Sweden
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    But it still works fine as a normal html file and with php tags with no commands or uncommented commands. It's a pretty big file and with a lot of crap in it because it's created with MS publisher or something like that. It will be a real hassle to retype it but maybe you're right clamcrusher, maybe there really is something wrong with the file that the browser ignores but when the php parser has to parse even just one command it fails.
    But if someone else has another idea I'll be glad to hear your input too.

  10. #10
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if you can use .htaccess files, you might be able to turn error reporting on that way

    Code:
    php_flag display_errors on
    ##2047 is E_ALL
    ## may need to try 6143 or 8191
    php_value error_reporting 2047

  11. #11
    SitePoint Zealot agoossens's Avatar
    Join Date
    Mar 2004
    Location
    Adelaide, Australia
    Posts
    124
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You might want to display PHP's startup errors as well, just in case. You'll have to do this with .htaccess though (if you've got it).
    This space for rent.


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
  •