SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast wallyweb's Avatar
    Join Date
    Oct 2003
    Location
    Saint John, NB, Canada
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP5 Apache2 Win 98 .php ok .html not

    OK! Now that we've all stopped laughing (Win 98 ) ...

    1. It works ... up to a point
    2. Set up is localhost:8080 for development/learning
    3. Windows98 SE patched, primed, primeval and paid for, Apache 2.0.52, PHP 5.0.2.2, MySQL 4.1
    4. php does not work in sqlphp.html. View Page Source returns:

    Code:
    <html>
    <head>
    <title>MySQL - PHP Test</title>
    </head>
    <body>
    <p>Welcome to Wally's MySQL - PHP Test Center.</p>
    <?php
    	echo( date ("l, F dS Y."));
    ?>
    </body>
    </html>

    5. Change ext from .html to .php and it works. View Page Source returns:

    Code:
    <html>
    <head>
    <title>MySQL - PHP Test</title>
    </head>
    <body>
    <p>Welcome to Wally's MySQL - PHP Test Center.</p>
    Saturday, November 20th 2004.</body>
    </html>

    6. So question is "Did I miss something in the tutorials?" ... or do any files containing php have to be saved as .php ?

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    That's how it's supposed work. PHP is not parsed unless the page is saved with a .php extension or you specify .html should be parsed as PHP in your conf/.htaccess files.

  3. #3
    SitePoint Enthusiast wallyweb's Avatar
    Join Date
    Oct 2003
    Location
    Saint John, NB, Canada
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Dan,

    And now that I know what to look for, I found a reference to .htaccess files in the manual folder, so back to school it is then.

  4. #4
    SitePoint Enthusiast wallyweb's Avatar
    Join Date
    Oct 2003
    Location
    Saint John, NB, Canada
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If anybody is still watching this thread, after a quick study of htaccess and SSI, there appears to be some concerns:

    1. If configured for htaccess, Apache searches all of its directories, top - down, and uses the last .htaccess found making for a potentially awesome hit on performance and, if on a shared server as with some ISP's, knocking out someone else's .htaccess (Did I reason that one out correctly?)

    2. SSI is really best suited for small amounts of code (performance hit again?) and not really suitable for a database driven page

    Ergo ... stick with .php?

  5. #5
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Not really... sticking with .php has nothign to do with whether or not you use .htaccess files, and you don't need to do that to force HTML be parsed as PHP. That was just one way -- you can specify it in your main conf file for the entire server, or you can force .html be parsed as PHP in individual folders (and their subfolders) by placing a .htaccess in that folder telling it to. It's not really a performance issue even if you do that... that's exactly how shared server users control apache options in their own folders without being able to change anything for any other user (other users' files are not in the directory tree of that .htaccess file).

  6. #6
    SitePoint Enthusiast wallyweb's Avatar
    Join Date
    Oct 2003
    Location
    Saint John, NB, Canada
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks again Dan,

    One last question ... Is this specific to Apache or do other servers have similar approaches? I'm thinking if someone commissions a web site project and it is designed on Apache (A safe bet considering the market penetration) but down the road they switch to another host where Apache is not available.


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
  •