Menu

Yet another new user with PHP issues

Help
Paul G
2005-07-06
2013-04-15
  • Paul G

    Paul G - 2005-07-06

    Hi,

    'Out of the box' install with no modifications onto an XP SP2 machine. Firewall and any other apps/services that may hook into IP were stopped. The only change was from the default location to D:\WebServ.

    No errors encountered during the install. No errors in the PHP error log. The httpd.conf and php.ini appear to have the correct entries. The path to the php folder is in the Path variable.

    Symptoms of the problem;

    .php files clicked on in Explorer open in Notepad.
    .php files right clicked/open with Internet Explorer display the content as text.
    http://127.0.0.1/phptest.php works.

    phptest.php contains the following;
    <html>
    <head>
    <title>PHP test page</title>
    </head>
    <body  >
    <? phpinfo(); ?>
    </body>
    </html>

    http://127.0.0.1/index.htm works apart from the following;
    I added <? phpinfo(); ?> to the default index.htm after the <body> tag and before the first <BLOCKQUOTE>. The file displays but no phpinfo is displayed. It does not even display as text, it seems to be ignored even though it is present in a 'view source'.

    I admit to knowing practically nothing about this apart from what I have found while trying to get this to work (total n00b).

    If it helps, I can post any relevant files to a WEB server or by Email.

    I need this to work. Can someone please offer some guidance? Thank you, Paul.

     
    • Nobody/Anonymous

      apache isnt parsing htm files for php content, only files with the ext php are parsed

       
      • Nobody/Anonymous

        its simple:

        You need to tell Apache to parse .html files for PHP code. Apache, by default, won't do this.
        Search in your apache config file for

        AddHandler application/x-httpd-php .php
        or
        AddType application/x-httpd-php .php

        These are the lines that tell Apache to parse your .php files for PHP code. Add the following "new line" to turn on parsing for .html files

        AddHandler application/x-httpd-php .php
        AddHandler application/x-httpd-php .html #new line

        or if you're using AddType for some reason

        AddType application/x-httpd-php .php
        AddType application/x-httpd-php .html #newline

         
    • Nobody/Anonymous

      oh yeah, dont add the '#new line' part

       
    • Paul G

      Paul G - 2005-07-07

      I already checked for this as I found it mentioned in a previous thread. I downloaded and installed the latest release so the 'patch' is included. Below is the PHP section from my config.

      ####  PHP  ###
      #@@PHP4@@LoadModule php4_module "D:/WebServ/php/php4apache2.dll"
      LoadModule php5_module "D:/WebServ/php/php5apache2.dll"

      AddType application/x-httpd-php .php
      AddType application/x-httpd-php .html
      AddType application/x-httpd-php-source .phps
      PHPIniDir "D:/WebServ/php"

      The path statements are correct for this install. The files exist.

      The symptoms do seem to point to this but all looks correct to my limited understanding.

      I have put the php.ini and httpd.conf here if it helps
      http://www.gwilliam.me.uk/config/php.ini
      http://www.gwilliam.me.uk/config/httpd.conf

      Thank yo for the prompt responses.

       
      • Nobody/Anonymous

        i noticed you saved your file as something.htm.... you should try it as something.html

         
        • Paul G

          Paul G - 2005-07-07

          That worked!

          I need to look into the differences between .htm and .html as I was not aware of the relevance. The default Apache page is .htm so I made the mistake of assuming that there was no difference. Never, never, NEVER assume!

          I also found that double clicking in Explorer does not work, it needs to be http://localhost/xxxx.html.

          THANK YOU.

          Now I can get on with the project I installed this for in the first place ;-)

           
          • Nobody/Anonymous

            you can set up the *.htm the same way as the *.html
            and yes in order for the php to be processed the call for that page needs to be requested via port 80 so that apache is called.... otherwise it is just being processed by your browser and apache is not activated to parse it...

            its just a good habit to use .html for your  document extensions as compared to htm...

            good luck!
            j.

             
    • Nobody/Anonymous

      Kool, everyone's hapy

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.