Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Aug 2009
    Location
    Maryland
    Posts
    47
    Thanks
    21
    Thanked 0 Times in 0 Posts

    PHP Includes Refuse To Work - Even Tried Parsing HTML As PHP

    About to rip my hair out. I am using Fatcow.com with CGI language - PHP 5.3. I cannot get my website includes to work at all. My web pages show blank space where my include PHP code is placed. My pages are in HTML format. I've tried changing my .htaccess file to parse HTML as PHP but I've had no luck. My includes are on the same level as my web pages.

    This is the PHP I am using in my HTML for my left navigation include:

    PHP Code:
    <?php include 'leftside.php'?>
    leftside.php is uploaded on the same level as my homepage.

    Right now, my .htaccess file is under my cgi-bin folder. I have this in my file:
    Code:
    AddType application/x-httpd-php5 .html .htm
    AddHandler application/x-httpd-php5 .html .htm
    Does anyone have any suggestions on what I might need to change/add? I can easily change PHP versions to a lower version but that doesn't seem to do anything. I have a feeling this is a path issue, but after hours of trying to test certain paths, I figured I'd better ask the pros!

    Here is my homepage code where I have the PHP include:

    Code:
     <div id="NavColumn">
           <?php include 'leftside.php'; ?>
         
        </div><!-- end NavColumn -->
    And of course, a link to the site I am trying to develop if you need to take a look. http://www.coldvirusdetective.com

    I really can't figure what could be wrong. I've had this working before, so I know it's possible to do... just missing something! Thanks in advance for any help again. This forum is a lifesaver!

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    All the changes in your .htaccess assume you have the privilege to do so. Looks to me that you do not. You'll need to change your pages into .php; I assumed that your second block of code there is your output source when viewed in a browser and I would presume that would be index.html.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #3
    New Coder
    Join Date
    Aug 2009
    Location
    Maryland
    Posts
    47
    Thanks
    21
    Thanked 0 Times in 0 Posts
    Thanks Fou-Lu. I spoke with my hosting company and they claim I have full permission to edit my .htaccess file. Shouldn't I be able to parse HTML as PHP? I'd rather not change my pages to .php unless absolute necessary.

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Yeah, if they've opened it up to allow override you should be able to.
    The only thing I can suggest is to try an addtype for only php (not the php5 specific):
    Code:
    AddType application/x-httpd-php .html .htm
    And see if the behaviour is still the same. .htaccess is runtime based, so you don't need to restart the services or anything.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • Users who have thanked Fou-Lu for this post:

    WebLizzard (04-11-2013)

  • #5
    New Coder
    Join Date
    Aug 2009
    Location
    Maryland
    Posts
    47
    Thanks
    21
    Thanked 0 Times in 0 Posts
    Thanks! I added the AddType line and guess what? It worked! Thank you SO SO SO much for that suggestion. You have no idea how many hours I spent yesterday trying to figure this out!
    Last edited by WebLizzard; 04-11-2013 at 05:08 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •