DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: Bumfuzzled again: PHP doesn't work on ONE (1) page <whimper /> ...  (Read 7,807 times)

barney

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 1,294
I don't even know how to troubleshoot/research this one.  There's a local Apache/MySQL/PHP installation on my dev box, latest - I think? - versions of each.

PHP files load just fine from most of the subdirs of the Web root.  However, there's one HTML (index.html) file that simply does not allow PHP to be recognized.  It's driving me buggy.  I've tried reinstalling both Apache and PHP, to no avail.  Nothing I can find in the HTML and related CSS file(s) would appear to be normal.  But a simple
Code: (php)
<?php include 'file.ext'; ?>
doesn't work, nor does it highlight properly in the editor (Komodo Edit).  As stated in the post title, I'm bumfuzzled :'(.
Make a good day ... barn

Eóin

  • O'Callaghan
  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 1,401
One guess, shouldn't the extension have to be .php, i.e. index.php?
Interviewer: Is there anything you don't like?
Bjarne Stroustrup: Marketing hype as a substitute for technical argument. Thoughtless adherence to dogma. Pride in ignorance.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,931
    • Gathering Badge
    • Plugin Coding Medal
    • Participated in NANY Challenge Seventeen Times
    • Cody Award
    • Coding Snacks
    • Volunteers/Staff
umm...

the lack of syntax highlighting should be a clue.

in php you need parentheses to use parentheses with include, as its a function.  e.g. include('file.ext'), don't you?
actually i see from php help pages you don't need parentheses.. though clearly your ide syntax highlighter thinks you do.. bah stupid language kludges.
« Last Edit: March 23, 2011, 01:16 AM by mouser »

barney

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 1,294


One guess, shouldn't the extension have to be .php, i.e. index.php?

That lets PHP know it's a PHP page, but I've oft included
Code
<?php ... ?>
in html pages w/o harm.  Although, perhaps I need to make some adjustment to httpd.conf?

Code
 <?php
    echo "Menu";
    include ('sidemenu.html');
  ?>
is the particular bit that's not being recognized.

Have I forgotten some httpd.conf configuration?  This is  a new installation, so I may have overlook some configuration, but I cannot see it (after many reviews of both httpd.conf and php.ini)

the lack of syntax highlighting should be a clue.

Yeah, I concur, but I cannot determine what the clue indicates.  Other pages indicate properly , some .html , some .php.
Make a good day ... barn

barney

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 1,294
:-[ :-[ :-[ :-[ :-[ :-[ :-[
I was calling the wrong file.
:-[ :-[ :-[ :-[ :-[ :-[ :-[

Doesn't change the rest of my confusion, though.

I was so certain of the file name that I never bothered to check that it was in place.  Damned dumb tyro error, ya know?

<sigh> Will I ever learn?</sigh>
Make a good day ... barn

Boydon

  • Supporting Member
  • Joined in 2010
  • **
  • Posts: 24
Next time just put a:

Code: (php)
<?php error_reporting(E_ALL | E_STRICT); ?>

at the beginning of you php file. This will enable very verbose warnings.

barney

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 1,294
Code
error_reporting = E_ALL & ~E_DEPRECATED
in PHP.ini ... but the error log being updated wasn't the error log I was tracking.  I seldom set PHP to report errors on-page, as that can significantly interfere with page structure.  I just lost track of which error log was being updated because of the multiple installs - basically, I confused myself  :-[.
Make a good day ... barn

widgewunner

  • Member
  • Joined in 2009
  • **
  • Posts: 93
First thing to run/check is <?php phpinfo(); ?>

barney

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 1,294
First thing to run/check is <?php phpinfo(); ?>
Well ... yeah ... but running phpinfo(); doesn't correct for idiocy  :P.  'Sides, there are other issues that phpinfo(); won't correct <sigh /> :'(.
Make a good day ... barn

Renegade

  • Tell me something you don't know...
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 13,291
    • Participated in NANY Challenge Three Times
    • Furry Fandom Badge - Furry Fandom
    • Linux User
Not sure if this is relevant, but I came across a situation where <?php vs. <? vs. <?php[major version] broke with some of those being deprecated and made obsolete. It took me a while to figure out the problem. That was a while ago though, and I don't remember the specifics.
Slow Down Music - Where I commit thought crimes...

Freedom is the right to be wrong, not the right to do wrong. - John Diefenbaker

barney

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 1,294
Re: Bumfuzzled again: PHP doesn't work on ONE (1) page <whimper /> ...
« Reply #10 on: March 24, 2011, 03:11 AM »
Not sure if this is relevant, but I came across a situation where <?php vs. <? vs. <?php[major version] broke with some of those being deprecated and made obsolete. It took me a while to figure out the problem. That was a while ago though, and I don't remember the specifics.

Oh, it is relevant ... fell into that trap many a time afore I disabled short keys.  Some servers just don't recognize 'em, and some servers want even more  :huh:.  Mostly a thing of the past, methinks, but definitely problematic at the time.
Make a good day ... barn

Original address: https://www.donationcoder.com/forum/index.php?topic=26152.0