How can I experiment with php on my pc?

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

    How can I experiment with php on my pc?

    I want to be able to play around with some php scripting on my pc
    without paying a company to host a domain.

    I have downloaded php onto my pc, at least I think I have, a folder
    called php has appeared on my C: drive, and I have downloaded and
    installed the Abyss web server and that appears to be working. I also
    have HTML Kit as my html editor.

    How do I get simple php scripts to work properly on my pc though? Where
    do I save the files?

    I know this may sound so simplistic to some, but I'm getting a real
    headache reading the php manual, frankly I don't understand half of it.

    Regards

  • Lars Eighner

    #2
    Re: How can I experiment with php on my pc?

    In our last episode,
    <1139562210.208 823.49630@z14g2 000cwz.googlegr oups.com>,
    the lovely and talented Denebola
    broadcast on comp.lang.php:
    [color=blue]
    > I want to be able to play around with some php scripting on my pc
    > without paying a company to host a domain.[/color]
    [color=blue]
    > I have downloaded php onto my pc, at least I think I have, a folder
    > called php has appeared on my C: drive, and I have downloaded and
    > installed the Abyss web server and that appears to be working. I also
    > have HTML Kit as my html editor.[/color]
    [color=blue]
    > How do I get simple php scripts to work properly on my pc though? Where
    > do I save the files?[/color]

    You can run php from the command line. I have no idea how you
    do this if you are stuck in a GUI like Windows, but if you can
    reach a command line prompt (and assuming php is in your path)
    simply enter

    php yourscript.php

    where yourscript.php is, of course some script you have written.

    redirect the output where you please:

    php yourscript.php > mydoc.html
    [color=blue]
    > I know this may sound so simplistic to some, but I'm getting a real
    > headache reading the php manual, frankly I don't understand half of it.[/color]

    I suggest you do not try to generate html pages immediately.

    Try to get

    <?php
    echo "Hello, World!";
    ?>

    to run first.

    --
    Lars Eighner usenet@larseigh ner.com http://www.larseighner.com/
    Fast, Cheap, Good: Choose any two.

    Comment

    • Peter Fox

      #3
      Re: How can I experiment with php on my pc?

      Following on from Denebola's message. . .[color=blue]
      >I want to be able to play around with some php scripting on my pc
      >without paying a company to host a domain.
      >
      >I have downloaded php onto my pc, at least I think I have, a folder
      >called php has appeared on my C: drive, and I have downloaded and
      >installed the Abyss web server and that appears to be working. I also
      >have HTML Kit as my html editor.
      >
      >How do I get simple php scripts to work properly on my pc though? Where
      >do I save the files?
      >
      >I know this may sound so simplistic to some, but I'm getting a real
      >headache reading the php manual, frankly I don't understand half of it.[/color]


      1. Get plain html pages to show (The server will define a root directory
      - you need to read those docs - Will take at least half an hour.)
      *While doing this the server docs should tell you how to get it to start
      and execute the php interpreter when it encounters a .php file request.*

      2. Write helloworld.php and put it in same dir as a working html page
      <?php print("Hello world"); ?>

      3. Put http://localhost/helloworld.php (etc) into your browser and
      Bob's your uncle.

      The snag is with starred bit in step 1. I've never heard of Abyss - If
      you can (and there may be good reasons why you can't) use Apache.

      --
      PETER FOX Not the same since the poster business went to the wall
      peterfox@eminen t.demon.co.uk.n ot.this.bit.no. html
      2 Tees Close, Witham, Essex.
      Gravity beer in Essex <http://www.eminent.dem on.co.uk>

      Comment

      • Georges.Kuntz

        #4
        Re: How can I experiment with php on my pc?


        "Denebola" <simon@minnican .co.uk> a écrit dans le message de
        news:1139562210 .208823.49630@z 14g2000cwz.goog legroups.com...[color=blue]
        > I want to be able to play around with some php scripting on my pc
        > without paying a company to host a domain.
        >
        > I have downloaded php onto my pc, at least I think I have, a folder
        > called php has appeared on my C: drive, and I have downloaded and
        > installed the Abyss web server and that appears to be working. I also
        > have HTML Kit as my html editor.
        >
        > How do I get simple php scripts to work properly on my pc though? Where
        > do I save the files?
        >
        > I know this may sound so simplistic to some, but I'm getting a real
        > headache reading the php manual, frankly I don't understand half of it.
        >
        > Regards
        >[/color]

        You can install Easyphp or Wamp server on you're PC. Very easy. Install it
        and it works.

        Georges



        Comment

        • Erwin Moller

          #5
          Re: How can I experiment with php on my pc?

          Lars Eighner wrote:
          [color=blue]
          >
          > You can run php from the command line. I have no idea how you
          > do this if you are stuck in a GUI like Windows, but if you can
          > reach a command line prompt (and assuming php is in your path)
          > simply enter[/color]

          goto start->run->command

          (you have to type command yourself)

          That will give you something like the good old dos-screen. :P

          Erwin Moller

          Comment

          • Skeets

            #6
            Re: How can I experiment with php on my pc?

            Denebola,

            The tutorials found here:

            Latest news coverage, email, free stock quotes, live scores and video are just the beginning. Discover more every day at Yahoo!


            seem to be pretty thorough.

            You install Apache first, then PHP. If you want, you can install
            PostgreSQL, too. it is a very nice open source database.

            Comment

            • Geoff Berrow

              #7
              Re: How can I experiment with php on my pc?

              Message-ID: <slrnduonb8.23n 0.usenet@goodwi ll.io.com> from Lars Eighner
              contained the following:
              [color=blue][color=green]
              >> How do I get simple php scripts to work properly on my pc though? Where
              >> do I save the files?[/color]
              >
              >You can run php from the command line.[/color]

              Why, when it is obvious that the OP is confused, do some people try to
              confuse them further??

              There are complete installations of PHP, Apache, MySql that you simply
              double click to install.

              Check out Xampp lite.



              --
              Geoff Berrow (put thecat out to email)
              It's only Usenet, no one dies.
              My opinions, not the committee's, mine.
              Simple RFDs http://www.ckdog.co.uk/rfdmaker/

              Comment

              • Gleep

                #8
                Re: How can I experiment with php on my pc?

                I agree with Geoff...

                go to apachefriends and download the "lite" version and run it
                it loads and configures apache, php, mysql, myadmin, perl and much more
                if you've never done this before - there might be a learning curve to get over but it's the easiet
                and fastest solution to turn your machine into a development server.




                On Fri, 10 Feb 2006 18:58:39 +0000, Geoff Berrow <blthecat@ckdog .co.uk> wrote:
                [color=blue]
                >Message-ID: <slrnduonb8.23n 0.usenet@goodwi ll.io.com> from Lars Eighner
                >contained the following:
                >[color=green][color=darkred]
                >>> How do I get simple php scripts to work properly on my pc though? Where
                >>> do I save the files?[/color]
                >>
                >>You can run php from the command line.[/color]
                >
                >Why, when it is obvious that the OP is confused, do some people try to
                >confuse them further??
                >
                >There are complete installations of PHP, Apache, MySql that you simply
                >double click to install.
                >
                >Check out Xampp lite.
                >
                >http://www.apachefriends.org/en/xampp-windows.html#646[/color]

                Comment

                • Lars Eighner

                  #9
                  Re: How can I experiment with php on my pc?

                  In our last episode,
                  <6dopu15d5see41 2dnqio8fkg7hsok h5l2j@4ax.com>,
                  the lovely and talented Geoff Berrow
                  broadcast on comp.lang.php:
                  [color=blue]
                  > Message-ID: <slrnduonb8.23n 0.usenet@goodwi ll.io.com> from Lars Eighner
                  > contained the following:[/color]
                  [color=blue][color=green][color=darkred]
                  >>> How do I get simple php scripts to work properly on my pc though? Where
                  >>> do I save the files?[/color]
                  >>
                  >>You can run php from the command line.[/color][/color]
                  [color=blue]
                  > Why, when it is obvious that the OP is confused, do some people try to
                  > confuse them further??[/color]
                  [color=blue]
                  > There are complete installations of PHP, Apache, MySql that you simply
                  > double click to install.[/color]

                  So why are you trying to confuse people further. It runs from
                  the command line. What could be simpler than that?
                  [color=blue]
                  > Check out Xampp lite.[/color]
                  [color=blue]
                  > http://www.apachefriends.org/en/xampp-windows.html#646[/color]

                  --
                  Lars Eighner usenet@larseigh ner.com http://www.larseighner.com/
                  My mail reader can beat up your mail reader.

                  Comment

                  • Geoff Berrow

                    #10
                    Re: How can I experiment with php on my pc?

                    Message-ID: <slrndupsu5.29g h.usenet@goodwi ll.io.com> from Lars Eighner
                    contained the following:
                    [color=blue][color=green]
                    >> There are complete installations of PHP, Apache, MySql that you simply
                    >> double click to install.[/color]
                    >
                    >So why are you trying to confuse people further. It runs from
                    >the command line. What could be simpler than that?[/color]

                    Did you actually read what the OP posted?

                    "I have downloaded php onto my pc, at least I think I have, a folder
                    called php has appeared on my C: drive, "

                    No disrespect to the OP, but I suspect he or she will not be comfortable
                    with operating from the command line.

                    --
                    Geoff Berrow (put thecat out to email)
                    It's only Usenet, no one dies.
                    My opinions, not the committee's, mine.
                    Simple RFDs http://www.ckdog.co.uk/rfdmaker/

                    Comment

                    • Denebola

                      #11
                      Re: How can I experiment with php on my pc?

                      I have to agree that I would not be happy working from a command
                      prompt. I have written the simplest html page i can as follows:

                      <html>
                      <head>
                      <title>simple php test</title>
                      </head>
                      <body>
                      <?php

                      echo( "Hello World!" ) ;

                      ?>


                      </body>
                      </html>

                      I have saved it in (index.html) the correct directory of my Abyss web
                      server, but when I call the page in IE by typing
                      http://localhost/index.html all I see is a blank page with the title
                      'simple php test'. It's almost as if the php part of the page is
                      ignored. I have installed php onto my webserver as instructed in the
                      abyss instructions. I'm very frustrated now. I'm probably missing a
                      very simple step somewhere here. I will try to install the Apache lite
                      version and try again. I'm determined to sort this out. Thanks for your
                      advice, and keep it coming.

                      Regards

                      Comment

                      • Anonymous

                        #12
                        Re: How can I experiment with php on my pc?

                        Denebola wrote:[color=blue]
                        >
                        > I have to agree that I would not be happy working from a command
                        > prompt. I have written the simplest html page i can as follows:
                        >
                        > <html>
                        > <head>
                        > <title>simple php test</title>
                        > </head>
                        > <body>
                        > <?php
                        >
                        > echo( "Hello World!" ) ;
                        >
                        > ?>
                        >
                        > </body>
                        > </html>
                        >
                        > I have saved it in (index.html) the correct directory of my Abyss web
                        > server, but when I call the page in IE by typing
                        > http://localhost/index.html all I see is a blank page with the title
                        > 'simple php test'. It's almost as if the php part of the page is
                        > ignored. I have installed php onto my webserver as instructed in the
                        > abyss instructions. I'm very frustrated now. I'm probably missing a
                        > very simple step somewhere here. I will try to install the Apache lite
                        > version and try again. I'm determined to sort this out. Thanks for your
                        > advice, and keep it coming.
                        >
                        > Regards[/color]

                        I have to admit I have never heard of Abyss, I'm using Apache myself.
                        But your problem sounds like one of these two possibilities:

                        1) The webserver isn't configured to use PHP.

                        2) The webserver doesn't know that it should parse the file through PHP.


                        The solution to 2 is easy:

                        Webservers are usually configured to parse files that end in .php
                        through PHP, but not files that end in .html. So you either rename the
                        file to index.php or you reconfigure your webserver to also parse .html
                        files (the latter not recommended).

                        If that doesn't work you need to check the configuration of your
                        webserver. Check your webserver's manual. You don't need to read the PHP
                        manual yet, as it is a PHP command reference, which you will only need
                        once you start programming.

                        Bye!

                        Comment

                        • Geoff Berrow

                          #13
                          Re: How can I experiment with php on my pc?

                          Message-ID: <1139649740.651 426.162770@g14g 2000cwa.googleg roups.com> from
                          Denebola contained the following:
                          [color=blue]
                          >I have to agree that I would not be happy working from a command
                          >prompt.[/color]

                          Thank you. I teach an introduction to programming class and know some
                          of the problems of getting started. The sheer amount of information is
                          available is very daunting for a newcomer and I find it useful to learn
                          just what you need to know at first and expand your knowledge later.
                          The learning curve is steep enough as it is. The manual is very
                          thorough and quite technical, but often there are examples of usage that
                          you can copy or adapt.

                          As for your test, it's been recommended that you rename the file
                          index.php This works exactly the same as index.htm or index.html except
                          that the php will be executed (it can be with other extensions but it is
                          not automatic - you have to configure the server to do so). However,
                          for testing I'd recommend you call it something meaningful e.g.
                          helloworld.php You can then build up a library of snippets that you can
                          call on as you progress.
                          --
                          Regards,

                          Geoff Berrow

                          Comment

                          • Dikkie Dik

                            #14
                            Re: How can I experiment with php on my pc?

                            What I have done:
                            - I first installed the webserver (personal webser that came with win98
                            in my xase)
                            - then installed PHP. the installer asked for a webserver, so I pointed
                            it to the one I had installed (was not reconised, but it is a version of
                            IIS, and pointing to IIS did the trick).
                            - Now the webserver can run .php files.

                            I have found a few Abysses, but this might be useful for you:


                            Where do you put the files?
                            That depends on the webserver. You probably have a webroot somewhere in
                            yoursystem. You can eiter make subdirectories under that webroot or add
                            a stie to your webserver.
                            Your webserver probaly has some managing option where you can add a site
                            or virtual directory. When you add a site, you have to give both the
                            virtual directory (http://localhost/yournewvirtualdirectory) and the
                            real directory (C:\your\real\d irectory\) that contains the files.

                            For a first test, just put the simple "hello world" example from PHP in
                            your webroot and see if that runs. If it doesn't, your webserver
                            probably does not know what to do with the .php extension.


                            Denebola wrote:[color=blue]
                            > I want to be able to play around with some php scripting on my pc
                            > without paying a company to host a domain.
                            >
                            > I have downloaded php onto my pc, at least I think I have, a folder
                            > called php has appeared on my C: drive, and I have downloaded and
                            > installed the Abyss web server and that appears to be working. I also
                            > have HTML Kit as my html editor.
                            >
                            > How do I get simple php scripts to work properly on my pc though? Where
                            > do I save the files?
                            >
                            > I know this may sound so simplistic to some, but I'm getting a real
                            > headache reading the php manual, frankly I don't understand half of it.
                            >
                            > Regards
                            >[/color]

                            Comment

                            • Denebola

                              #15
                              Re: How can I experiment with php on my pc?

                              Well I must thank you all sincerely. I now have the ability to test
                              simple php scripting on my pc. I'm now using Apache as my webserver. I
                              do however have much to learn and will no doubt be asking similarly
                              simplistic questions in the very near future.

                              Kind regards.

                              Comment

                              Working...