Install oddity Win2K/Apache2/PHP4

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Greg Bryant

    Install oddity Win2K/Apache2/PHP4

    PHP Newbie question: I installed the above, and if I point directly to a
    ..php file (i.e. http://localhost/phpinfo.php, I get the php script executed
    properly. If I put a <?php ... ?> tag in html, nothing happens. No error
    in any Apache logs, no obvious errors in php, nothing displayed on the
    page.

    I installed as cgi, I saw an earlier post someone recommended SAPI - could
    that be a problem (I'm guessing it's some line in one of the configs I
    screwed up).

    Thanks,
    -G
  • Ian.H

    #2
    Re: Install oddity Win2K/Apache2/PHP4

    On Wed, 29 Oct 2003 14:15:53 +0000, Greg Bryant wrote:
    [color=blue]
    > PHP Newbie question: I installed the above, and if I point directly to a
    > .php file (i.e. http://localhost/phpinfo.php, I get the php script executed
    > properly. If I put a <?php ... ?> tag in html, nothing happens. No error
    > in any Apache logs, no obvious errors in php, nothing displayed on the
    > page.
    >
    > I installed as cgi, I saw an earlier post someone recommended SAPI - could
    > that be a problem (I'm guessing it's some line in one of the configs I
    > screwed up).
    >
    > Thanks,
    > -G[/color]


    If installed as a CGI, I think the scripts need to be coded like Perl
    scripts and use a Shebang line:


    #!/usr/bin/php
    [ ... rest of script ... ]


    rather than the "usual" <?php ... ?> tag method. Your path to your PHP
    binary may differ to the above naturally =)

    My recommendation would be to reinstall as a module rather than CGI as
    this is both faster and more secure.


    HTH =)



    Regards,

    Ian

    --
    Ian.H [Design & Development]
    digiServ Network - Web solutions
    www.digiserv.net | irc.digiserv.ne t | forum.digiserv. net
    Programming, Web design, development & hosting.

    Comment

    • Pedro

      #3
      Re: Install oddity Win2K/Apache2/PHP4

      Greg Bryant wrote:[color=blue]
      > PHP Newbie question: I installed the above, and if I point directly to a
      > .php file (i.e. http://localhost/phpinfo.php, I get the php script executed
      > properly. If I put a <?php ... ?> tag in html, nothing happens. No error
      > in any Apache logs, no obvious errors in php, nothing displayed on the
      > page.
      >
      > I installed as cgi, I saw an earlier post someone recommended SAPI - could
      > that be a problem (I'm guessing it's some line in one of the configs I
      > screwed up).
      >
      > Thanks,
      > -G[/color]

      Well ... I never used PHP as a cgi, but with php as a module and apache
      not configured to call php for xxx.html pages the php code is send
      "as-is" to the browser. Check the page source and you'll see the source
      there. My guess is your browser is hiding the <?php ... ?> tags the same
      way it hides <b>, <a title="xxx">, etc.


      --
      I have a spam filter working.
      To mail me include "urkxvq" (with or without the quotes)
      in the subject line, or your mail will be ruthlessly discarded.

      Comment

      • zdope

        #4
        Re: Install oddity Win2K/Apache2/PHP4

        Pedro <hexkid@hotpop. com> wrote in message news:<bnojsa$14 1qpr$1@ID-203069.news.uni-berlin.de>...[color=blue]
        > Greg Bryant wrote:[color=green]
        > > PHP Newbie question: I installed the above, and if I point directly to a
        > > .php file (i.e. http://localhost/phpinfo.php, I get the php script executed
        > > properly. If I put a <?php ... ?> tag in html, nothing happens. No error
        > > in any Apache logs, no obvious errors in php, nothing displayed on the
        > > page.
        > >
        > > I installed as cgi, I saw an earlier post someone recommended SAPI - could
        > > that be a problem (I'm guessing it's some line in one of the configs I
        > > screwed up).
        > >
        > > Thanks,
        > > -G[/color]
        >
        > Well ... I never used PHP as a cgi, but with php as a module and apache
        > not configured to call php for xxx.html pages the php code is send
        > "as-is" to the browser. Check the page source and you'll see the source
        > there. My guess is your browser is hiding the <?php ... ?> tags the same
        > way it hides <b>, <a title="xxx">, etc.[/color]

        It is noted in the PHP documentation that PHP is not supported in
        Apache2 except at highly experimental levels. You might be having
        other issues as well, but to be sure I would downgrade your Apache
        version to 1.3.28.

        It is also noted in the PHP docs that running PHP as a CGI from Apache
        is not all that good of an idea unless you really know what you are
        doing.

        To run PHP as an Apache Module in 1.3.28, configure your php.ini file
        with the needed info and then copy php.ini and php4ts.dll to the
        Apache server root. Then add the following lines to your httpd.conf
        file in the appropriate sections:

        LoadModule php4_module c:/php4win/sapi/php4apache.dll

        AddModule mod_php4.c

        AddType application/x-httpd-php .php
        AddType application/x-httpd-php-source .phps

        Comment

        • zdope

          #5
          Re: Install oddity Win2K/Apache2/PHP4

          Pedro <hexkid@hotpop. com> wrote in message news:<bnojsa$14 1qpr$1@ID-203069.news.uni-berlin.de>...[color=blue]
          > Greg Bryant wrote:[color=green]
          > > PHP Newbie question: I installed the above, and if I point directly to a
          > > .php file (i.e. http://localhost/phpinfo.php, I get the php script executed
          > > properly. If I put a <?php ... ?> tag in html, nothing happens. No error
          > > in any Apache logs, no obvious errors in php, nothing displayed on the
          > > page.
          > >
          > > I installed as cgi, I saw an earlier post someone recommended SAPI - could
          > > that be a problem (I'm guessing it's some line in one of the configs I
          > > screwed up).
          > >
          > > Thanks,
          > > -G[/color]
          >
          > Well ... I never used PHP as a cgi, but with php as a module and apache
          > not configured to call php for xxx.html pages the php code is send
          > "as-is" to the browser. Check the page source and you'll see the source
          > there. My guess is your browser is hiding the <?php ... ?> tags the same
          > way it hides <b>, <a title="xxx">, etc.[/color]

          Another thing about embedding php in a doc with a .html extension...
          it won't work. You need to rename the file with a .php extension in
          order for the server to proerly parse the info.

          Comment

          • Ian.H

            #6
            Re: Install oddity Win2K/Apache2/PHP4

            On Wed, 29 Oct 2003 19:00:52 -0800, zdope wrote:
            [color=blue]
            > Another thing about embedding php in a doc with a .html extension... it
            > won't work. You need to rename the file with a .php extension in order for
            > the server to proerly parse the info.[/color]


            That's completely wrong!

            You configure what extensions you want to parse as PHP files when you
            install / config it all, there's _nothing_ to stop you using .html files
            for PHP execution, although personally, I wouldn't recommend it.



            Regards,

            Ian

            --
            Ian.H [Design & Development]
            digiServ Network - Web solutions
            www.digiserv.net | irc.digiserv.ne t | forum.digiserv. net
            Programming, Web design, development & hosting.

            Comment

            • zdope

              #7
              Re: Install oddity Win2K/Apache2/PHP4

              zdopev1b@hotmai l.com (zdope) wrote in message news:<b60a2824. 0310291900.75fc 2f5b@posting.go ogle.com>...[color=blue]
              > Pedro <hexkid@hotpop. com> wrote in message news:<bnojsa$14 1qpr$1@ID-203069.news.uni-berlin.de>...
              >
              > Another thing about embedding php in a doc with a .html extension...
              > it won't work. You need to rename the file with a .php extension in
              > order for the server to proerly parse the info.[/color]

              CORRECTION:
              "gf" <gfraley5@earth link.net> wrote in message news:<iJ0ob.775 2$Px2.150@newsr ead4.news.pas.e arthlink.net>.. .[color=blue]
              >
              > In your apache httpd.conf file, make sure you have this line (or similar) to
              > parse your php code in your .htm* documents. That will resolve your issue.
              >
              > AddType application/x-httpd-php .phtml .php .php3 .htm .html[/color]

              Comment

              Working...