Jump to content

how do i run php on my web server or at home

- - - - -

  • Please log in to reply
18 replies to this topic

#1
iscofield

iscofield

    Newbie

  • Members
  • PipPip
  • 10 posts
pls am new and i need help in running php cod like to dislay hello world where do i put the code is it at my web server or where and after that how do i run it. Thanks

#2
gregwarner

gregwarner

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 853 posts
  • Location:Arkansas
You'll need to download and install the PHP interpreter.
PHP: Downloads
If you don't have a web server running on your home computer yet, you'll need that too. I suggest Apache.
Apache Download Mirrors
It's worth noting there are some packages out there that bundle a web server and the PHP interpreter together, which might be easier to install and configure. I just don't happen to know of any by name because being a network admin, I always just install the individual components manually. Perhaps if someone else can suggest one.
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.

– Douglas Hofstadter, Gödel, Escher, Bach: An Eternal Golden Braid


#3
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
  • Location:Vancouver, Eh! Cleverness: 200
You can download XAMPP (check this section's sticky FAQ, there are links there) and you can run your own self contained server on your home computer.

A quick example of the simplicity, is C:\xampp\www\index.php can be ran in the browser as http://localhost/index.php and interpreted correctly.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#4
Aetion

Aetion

    Newbie

  • Members
  • Pip
  • 4 posts
Hi iscofield,

Besides XAMPP, theres also Vertrigo

I feel Vertrigo is more simpler than XAMPP. Although both are great !! :)

#5
iscofield

iscofield

    Newbie

  • Members
  • PipPip
  • 10 posts
thanks every one is really helping but i like the vertrigo becos is small in size but if after installation can i work with it directly or are there other set up and configuration

#6
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
  • Location:Vancouver, Eh! Cleverness: 200
It should allow you to start up the main program and work with it, XAMPP is very easy like this as well so I would assume that Vertigo is too.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#7
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
  • Location:Vancouver, Eh! Cleverness: 200
Hello iscofield (in reply to your private message)

When the program installs, it should place a folder of which you can store your PHP files, the software website does not give any details I suspect however it may be in C:\vertrigo\www or C:\vertrigo\htdocs and similar.

Feel free to look in the installation folder until you find where to put your PHP scripts if there is an example one, or there is a help menu in the program!

Once you install index.php (or whichever you name your PHP file) in to the folder, you can access it through this host: http://localhost/yourfile.php and it will act as a real PHP script parsing it.

Feel free to try it out and report back if you have any success, I can install the software if you wish to find out what to do!

Alexander.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#8
bbqroast

bbqroast

    Codecall Addict

  • Members
  • PipPipPipPipPipPipPip
  • 554 posts
  • Location:/etc/passwd
...
I'm having thoughts about setting up a XAMPP installation with a detailed tutorial, just finished explaining this last night...
Please, write clearly with proper structure. Double spacing makes the text feel un-jointed, Capitalizing Every Word Means People Stop Before Every Word Sub-Consciously Which Is A Pain In The Backside, and use code tags! (The right most styling box).

#9
iscofield

iscofield

    Newbie

  • Members
  • PipPip
  • 10 posts
actually the root folder is www and in it there is index.php along other files i think that index.php is an example, but what i did is that in my browser i put http://localhost/www/index.php i even try creating a folder in www to copy the index.php but yet did not work maybe i will try http://localhost/index.php as explain by alex... I will report back soon. Thanks everybody.
Or could it be becos i install it in c:/program/vertrigo instead of c:/vertrigo....

#10
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
  • Location:Vancouver, Eh! Cleverness: 200
Hello iscofield,

You want to place the documents in the www folder, not create one, you are doing this I assume, "www/www/index.php" of which is not intended rather than www/index.php

You can however access http://localhost/www/index.php to access that (however it is not as simple)

Also a note, when you post links it may become moderated ,please be patient and not post as many duplicates as you do, they will be approved when a moderator sees it.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#11
iscofield

iscofield

    Newbie

  • Members
  • PipPip
  • 10 posts
i did it as u wrote http://localhost/www/index.php still no response wwhy don't u just install to test it making it easy pls

#12
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
  • Location:Vancouver, Eh! Cleverness: 200
Of course I will, when I start up the program I click "Hide this window and start server" if you already hadn't, you can right click the icon on the taskbar and go to the "WWW folder"

For me it is located here:
C:\Program Files\VertrigoServ\www
It has a few sample folders, feel free to delete everything inside the www folder (i.e. inc, gfx, template, index.php, favicon unless you want them) and place your own index.php in there.

Maybe have the index.php contain this:
<?php
phpinfo();
?>
This function will display various information about PHP, and if you see a lot of output then PHP will be working!

As long as the server is running (and the icon has a green + symbol on the taskbar icon) then you should be able to access localhost, or 127.0.0.1 whichever you prefer and have the scripts appear as they are.

I would be glad to explain further if you have any trouble setting this up,
Alexander.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users