Problem running PHP on localhost

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Phil Preen

    #1

    Problem running PHP on localhost

    I have installed Apache and PHP (and MySQL) on my own computer so that I can
    test
    out my scripts without having to keep uploading them to my ISP.
    I have created a very simple php script (below) just to test out my set-up.
    This works fine when I upload it to the server at my ISP (when I type
    something
    in the box, it is displayed back to me) but when I run it on my own system,
    I get nothing. I can see the value in the querystring in the address bar of
    my browser, but the $eek variable does not seem to be being set. Is there
    something I need to enable in PHP or Apache to make this work?
    TIA
    Phil.

    <HTML>
    <BODY>
    <?php
    echo $eek;
    ?>
    <FORM>
    <INPUT name=eek>
    </FORM>
    </BODY>
    </HTML>




  • Phil Preen

    #2
    Re: Problem running PHP on localhost


    "Phil Preen" <n/awrote in message
    news:466f075c$0 $8753$ed2619ec@ ptn-nntp-reader02.plus.n et...
    >I have installed Apache and PHP (and MySQL) on my own computer so that I
    >can test
    out my scripts without having to keep uploading them to my ISP.
    I have created a very simple php script (below) just to test out my
    set-up.
    This works fine when I upload it to the server at my ISP (when I type
    something
    in the box, it is displayed back to me) but when I run it on my own
    system,
    I get nothing. I can see the value in the querystring in the address bar
    of
    my browser, but the $eek variable does not seem to be being set. Is there
    something I need to enable in PHP or Apache to make this work?

    Found it. I needed to set register_global s=on in php.ini


    Comment

    • =?iso-8859-1?Q?Kim_Andr=E9_Aker=F8?=

      #3
      Re: Problem running PHP on localhost

      Phil Preen wrote:
      >
      "Phil Preen" <n/awrote in message
      news:466f075c$0 $8753$ed2619ec@ ptn-nntp-reader02.plus.n et...
      I have installed Apache and PHP (and MySQL) on my own computer so
      that I can test out my scripts without having to keep uploading
      them to my ISP. I have created a very simple php script (below)
      just to test out my set-up. This works fine when I upload it to
      the server at my ISP (when I type something in the box, it is
      displayed back to me) but when I run it on my own system, I get
      nothing. I can see the value in the querystring in the address bar
      of my browser, but the $eek variable does not seem to be being set.
      Is there something I need to enable in PHP or Apache to make this
      work?
      >
      Found it. I needed to set register_global s=on in php.ini
      The requirement of register_global s being on is just a result of bad
      programming practices, really. You should make an effort to use the
      $_POST and $_GET arrays instead, based on the request method ("post" or
      "get"). In a pinch, use the $_REQUEST array, but please note that this
      also contains the elements from $_COOKIE as well (HTTP cookies).

      As for server variables, use $_SERVER instead.

      PHP manual: Using Register Globals:
      PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.


      --
      Kim André Akerø
      - kimandre@NOSPAM betadome.com
      (remove NOSPAM to contact me directly)

      Comment

      Working...