Apache 2.0.54, Windows 2k, and php5.0.5 - do the work together

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • weissborn@charter.net

    Apache 2.0.54, Windows 2k, and php5.0.5 - do the work together

    I'm a php newbie. I have installed apache 2.0.54 and php 5.0.5 on my
    win2k box. However, it does not appear the php is working properly. I
    base this on the following code(which I got from a book):

    <html>
    <head>
    <title>Listin g Server Variables</title>
    </head>
    <body>
    <h2>PHP and HTML</h2>
    <P>Server Variables</P>
    <?php
    $envs = array ("HTTP_REFERER" , "HTTP_USER_AGEN T", "REMOTE_ADD R",
    "REMOTE_HOS T", "QUERY_STRI NG", "PATH_INFO" );
    foreach ($envs as $env)
    print "$env: $GLOBALS[$env]<br>";
    ?>
    </body>
    </html>

    All I get when I access via: http://localhost/phptest1.html is:

    PHP and HTML

    Server Variables
    "; ?>

    So, my first question is "Do these versions of software play well
    together?" If so, where do I look first? I have added the following
    lines to httpd.conf:

    LoadModule php5_module "C:/php5/php5apache2.dll "
    PHPIniDir "C:/php5"
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps

    I took the php.ini.recomme nded, changed the name to php.ini, then
    changed doc_root as follows:

    doc_root = "C:\Program Files\Apache Group\Apache2\h tdocs"

    If these versions will play together, then what have I overlooked in
    the install? Any help, comments, suggestions, are welcome.

    Bill W

  • IWP506@gmail.com

    #2
    Re: Apache 2.0.54, Windows 2k, and php5.0.5 - do the work together

    May be a stupid question, but did you restart apache after installing
    PHP? And did you put php.ini in C:\windows or winnt or whatever your
    windows path is?

    Comment

    • Obvious

      #3
      Re: Apache 2.0.54, Windows 2k, and php5.0.5 - do the work together

      On 10 Sep 2005 21:32:19 -0700, IWP506@gmail.co m wrote:
      [color=blue]
      > May be a stupid question, but did you restart apache after installing
      > PHP? And did you put php.ini in C:\windows or winnt or whatever your
      > windows path is?[/color]

      And what pray are you replying to?

      Learn to quote!

      Comment

      • Rincewind

        #4
        Re: Apache 2.0.54, Windows 2k, and php5.0.5 - do the work together

        On 10 Sep 2005 20:33:37 -0700, weissborn@chart er.net wrote:
        [color=blue]
        > All I get when I access via: http://localhost/phptest1.html is:
        >
        > PHP and HTML
        >
        > Server Variables
        > "; ?>[/color]

        That's probably because you've saved the file as .HTM or .HTML, save it as
        php and it will work fine.

        Comment

        • weissborn@charter.net

          #5
          Re: Apache 2.0.54, Windows 2k, and php5.0.5 - do the work together

          changed to .php and accessed via http://localhost/phptest1.php and now
          I get the following:

          PHP and HTML

          Server Variables
          HTTP_REFERER:
          HTTP_USER_AGENT :
          REMOTE_ADDR:
          REMOTE_HOST:
          QUERY_STRING:
          PATH_INFO:

          BUT shouldn't I be seeing some values here? Do I have php/apache
          configured properly (see original post)?

          Bill W

          Comment

          • Rincewind

            #6
            Re: Apache 2.0.54, Windows 2k, and php5.0.5 - do the work together

            On 11 Sep 2005 10:26:55 -0700, weissborn@chart er.net wrote:
            [color=blue]
            > changed to .php and accessed via http://localhost/phptest1.php and now
            > I get the following:
            >
            > PHP and HTML
            >
            > Server Variables
            > HTTP_REFERER:
            > HTTP_USER_AGENT :
            > REMOTE_ADDR:
            > REMOTE_HOST:
            > QUERY_STRING:
            > PATH_INFO:
            >
            > BUT shouldn't I be seeing some values here? Do I have php/apache
            > configured properly (see original post)?
            >
            > Bill W[/color]

            Your getting the same as me! and I'm using the same configuration.

            Have you tried the basic ..

            <?php

            phpinfo();

            ?>

            This should list everything you need, if it doesn't then you may have
            problems, but if the previous script threw up the same as my working
            machine, then I would guess that yours is working fine.

            If you want info on the global variables on your system the run this:



            <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
            "http://www.w3.org/TR/html4/loose.dtd">

            <html>
            <head>
            <meta name="Generator " content="TextPa d 4.7">
            <meta name="Author" content="Barry Ambrose">
            <meta name="Keywords" content="?">
            <meta name="Descripti on" content="?">
            <meta http-equiv="content-type" content="text/html;charset=is o-8859-1">
            <title>Global Variables</title>
            <style type="text/css">
            body{background-color: #fff}
            font-size: .8em;
            font-family: arial serif;
            </style>
            </head>
            <body>
            <table width="100%" border="1">
            <tr><td colspan="2"><h1 >Displaying Predefined Variables</h1></td>
            </tr>
            <tr><td width="40%" valign="top">Gl obals - $GLOBALS</td>
            <td width="60%"><pr e>
            <?php
            echo "<pre>";
            print_r($GLOBAL S);
            echo "</pre>";
            ?>
            </td>
            </tr>
            <tr><td width="40%" valign="top">Se rver - $_SERVER</td>
            <td width="60%"><pr e>
            <?php
            echo "<pre>";
            print_r($_SERVE R);
            echo "</pre>";
            ?>
            </td>
            </tr>
            <tr><td width="40%" valign="top">
            Get - $_GET</td>
            <td width="60%"><pr e>
            <?php
            echo "<pre>";
            print_r($_GET);
            echo "</pre>";
            ?>
            </td>
            </tr>
            <tr><td width="40%" valign="top">Po st - $_POST</td>
            <td width="60%"><pr e>
            <?php
            echo "<pre>";
            print_r($_POST) ;
            echo "</pre>";
            ?>
            </td>
            </tr>
            <tr><td width="40%" valign="top">Co okie - $_COOKIE</td>
            <td width="60%"><pr e>
            <?php
            echo "<pre>";
            print_r ($_COOKIE) ;
            echo "</pre>";
            ?>
            </td>
            </tr>
            <tr><td width="40%" valign="top">Fi les - $_FILES</td>
            <td width="60%"><pr e>
            <?php
            echo "<pre>";
            print_r ($_FILES);
            echo "</pre>";
            ?>
            </td>
            </tr>
            <tr><td width="40%" valign="top">En vironment - $_ENV</td>
            <td width="60%>
            <?php
            echo "<pre>";
            print_r($_ENV);
            echo "</pre>";
            ?>
            </td>
            </tr>
            <tr><td width="40%" valign="top">Re quest - $_REQUEST</td>
            <td width="60%"><pr e>
            <?php
            echo "<pre>";
            print_r($_REQUE ST);
            echo "</pre>";
            ?>
            </td>
            </tr>
            <tr><td width="40%" valign="top">Se ssion - $_SESSION</td>
            <td width="60%"><pr e>
            <?php
            echo "<pre>";
            print_r($_SESSI ON);
            echo "</pre>";
            ?>
            </td>
            </tr>
            </table>
            </body>
            </html>

            But this will only give you much the same info as the first script.

            Comment

            • Rincewind

              #7
              Re: Apache 2.0.54, Windows 2k, and php5.0.5 - do the work together

              On 11 Sep 2005 10:26:55 -0700, weissborn@chart er.net wrote:
              [color=blue]
              > changed to .php and accessed via http://localhost/phptest1.php and now
              > I get the following:
              >
              > PHP and HTML
              >
              > Server Variables
              > HTTP_REFERER:
              > HTTP_USER_AGENT :
              > REMOTE_ADDR:
              > REMOTE_HOST:
              > QUERY_STRING:
              > PATH_INFO:
              >
              > BUT shouldn't I be seeing some values here? Do I have php/apache
              > configured properly (see original post)?
              >
              > Bill W[/color]

              Of course if you upload to a webserver and run it you will get different
              results.

              Comment

              • Andy Hassall

                #8
                Re: Apache 2.0.54, Windows 2k, and php5.0.5 - do the work together

                On 10 Sep 2005 20:33:37 -0700, "weissborn@char ter.net" <weissborn@char ter.net>
                wrote:
                [color=blue]
                >I'm a php newbie. I have installed apache 2.0.54 and php 5.0.5 on my
                >win2k box. However, it does not appear the php is working properly. I
                >base this on the following code(which I got from a book):[/color]

                The book is apparently quite old.
                [color=blue]
                ><?php
                >$envs = array ("HTTP_REFERER" , "HTTP_USER_AGEN T", "REMOTE_ADD R",
                > "REMOTE_HOS T", "QUERY_STRI NG", "PATH_INFO" );
                >foreach ($envs as $env)
                > print "$env: $GLOBALS[$env]<br>";[/color]

                None of the above are set as globals in the default and recommended
                configuration of PHP since PHP 4.2.0.

                You (correctly) have register_global s disabled. See the manual for more
                details.

                The content you're after will be available from the $_SERVER array.

                --
                Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
                http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

                Comment

                • claudel

                  #9
                  Re: Apache 2.0.54, Windows 2k, and php5.0.5 - do the work together

                  In article <0m09i1lskqaeot n78ipsa6s8smrfe 35rqq@4ax.com>,
                  Andy Hassall <andy@andyh.co. uk> wrote:[color=blue]
                  >On 10 Sep 2005 20:33:37 -0700, "weissborn@char ter.net" <weissborn@char ter.net>
                  >wrote:
                  >[color=green]
                  >>I'm a php newbie. I have installed apache 2.0.54 and php 5.0.5 on my
                  >>win2k box. However, it does not appear the php is working properly. I
                  >>base this on the following code(which I got from a book):[/color]
                  >
                  > The book is apparently quite old.
                  >[color=green]
                  >><?php
                  >>$envs = array ("HTTP_REFERER" , "HTTP_USER_AGEN T", "REMOTE_ADD R",
                  >> "REMOTE_HOS T", "QUERY_STRI NG", "PATH_INFO" );
                  >>foreach ($envs as $env)
                  >> print "$env: $GLOBALS[$env]<br>";[/color]
                  >
                  > None of the above are set as globals in the default and recommended
                  >configuratio n of PHP since PHP 4.2.0.
                  >
                  > You (correctly) have register_global s disabled. See the manual for more
                  >details.
                  >
                  > The content you're after will be available from the $_SERVER array.
                  >
                  >--
                  >Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
                  >http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool[/color]

                  Make a fiel, call it test.php.

                  cut 'n paste this into it

                  _______________ ___

                  <?php

                  phpinfo();

                  ?>

                  _______________ ____

                  load the fiel from your server root with your browser.

                  If it gives you a bunch of info then your setup is working.

                  If not, then it is not.


                  Happy Trails


                  Claude

                  Comment

                  • weissborn@charter.net

                    #10
                    Re: Apache 2.0.54, Windows 2k, and php5.0.5 - do the work together

                    the phpinfo() did the trick....I get all sorts of info so I guess it is
                    working. Yes, the book is old. "Teach yourself PHP in 24hrs",
                    copyright 2002. Got it for less than a dollar at a garage sale....

                    Ok....so it looks like I do indeed have everything configured
                    correctly. Thanks for the info.

                    Bill W

                    Comment

                    • claudel

                      #11
                      Re: Apache 2.0.54, Windows 2k, and php5.0.5 - do the work together

                      In article <1126483341.719 011.88570@g44g2 000cwa.googlegr oups.com>,
                      weissborn@chart er.net <weissborn@char ter.net> wrote:[color=blue]
                      >the phpinfo() did the trick....I get all sorts of info so I guess it is
                      >working. Yes, the book is old. "Teach yourself PHP in 24hrs",
                      >copyright 2002. Got it for less than a dollar at a garage sale....
                      >
                      >Ok....so it looks like I do indeed have everything configured
                      >correctly. Thanks for the info.
                      >
                      >Bill W
                      >[/color]

                      Cool

                      There is much more up-to-date info on the net...

                      Claude

                      Comment

                      • David

                        #12
                        Re: Apache 2.0.54, Windows 2k, and php5.0.5 - do the work together

                        I have Win2k, Apache, and PHP and the localhost is set up for IIS at
                        port 80. I had to set up Apache on port 8080.

                        No IIS on the machine?


                        On 10 Sep 2005 20:33:37 -0700, "weissborn@char ter.net"
                        <weissborn@char ter.net> wrote:
                        [color=blue]
                        >I'm a php newbie. I have installed apache 2.0.54 and php 5.0.5 on my
                        >win2k box. However, it does not appear the php is working properly. I
                        >base this on the following code(which I got from a book):
                        >
                        >
                        >All I get when I access via: http://localhost/phptest1.html is:[/color]

                        Comment

                        • IWP506@gmail.com

                          #13
                          Re: Apache 2.0.54, Windows 2k, and php5.0.5 - do the work together


                          Obvious wrote:[color=blue]
                          > On 10 Sep 2005 21:32:19 -0700, IWP506@gmail.co m wrote:
                          >[color=green]
                          > > May be a stupid question, but did you restart apache after installing
                          > > PHP? And did you put php.ini in C:\windows or winnt or whatever your
                          > > windows path is?[/color]
                          >
                          > And what pray are you replying to?
                          >
                          > Learn to quote![/color]

                          The topic creator? I though it was "obvious" (pun completly intended).
                          I'm on Google Groups, so maybe it's not as apparent to you guys or
                          something.

                          iwp506@gmail.co m

                          Comment

                          • Bill Segraves

                            #14
                            Re: Apache 2.0.54, Windows 2k, and php5.0.5 - do the work together

                            <IWP506@gmail.c om> wrote in message
                            news:1126560777 .181199.106020@ g47g2000cwa.goo glegroups.com.. .[color=blue]
                            >
                            > Obvious wrote:[color=green]
                            > > On 10 Sep 2005 21:32:19 -0700, IWP506@gmail.co m wrote:
                            > >[color=darkred]
                            > > > May be a stupid question, but did you restart apache after installing
                            > > > PHP? And did you put php.ini in C:\windows or winnt or whatever your
                            > > > windows path is?[/color]
                            > >
                            > > And what pray are you replying to?
                            > >
                            > > Learn to quote![/color]
                            >
                            > The topic creator? I though it was "obvious" (pun completly intended).
                            > I'm on Google Groups, so maybe it's not as apparent to you guys or
                            > something.[/color]

                            Learn to use the quoting features of Google Groups! It is customary to quote
                            enough of the post to which you are responding for readers to be able to
                            understand the context of your response.

                            --
                            Bill Segraves


                            Comment

                            • IWP506@gmail.com

                              #15
                              Re: Apache 2.0.54, Windows 2k, and php5.0.5 - do the work together

                              I don't understand. Somebody asked a question. I posted the first
                              reply. Who else could I be responding to? Which part is confusing?

                              Bill Segraves wrote:[color=blue]
                              > <IWP506@gmail.c om> wrote in message
                              > news:1126560777 .181199.106020@ g47g2000cwa.goo glegroups.com.. .[color=green]
                              > >
                              > > Obvious wrote:[color=darkred]
                              > > > On 10 Sep 2005 21:32:19 -0700, IWP506@gmail.co m wrote:
                              > > >
                              > > > > May be a stupid question, but did you restart apache after installing
                              > > > > PHP? And did you put php.ini in C:\windows or winnt or whatever your
                              > > > > windows path is?
                              > > >
                              > > > And what pray are you replying to?
                              > > >
                              > > > Learn to quote![/color]
                              > >
                              > > The topic creator? I though it was "obvious" (pun completly intended).
                              > > I'm on Google Groups, so maybe it's not as apparent to you guys or
                              > > something.[/color]
                              >
                              > Learn to use the quoting features of Google Groups! It is customary to quote
                              > enough of the post to which you are responding for readers to be able to
                              > understand the context of your response.
                              >
                              > --
                              > Bill Segraves[/color]

                              Comment

                              Working...