Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
- - - - -

Test Your Php Pages W/o Upload/internet


67 replies to this topic

#61 frozen.fish

    Super Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 348 posts
  • Gender:Male
  • Location:Everywhere
  • myCENT:42.64

Posted 08 April 2009 - 07:10 AM

I use WAMP too.. but XAMMP has portable version which I might need..

#62 Ash-Bash

    1337 HaxXx0r

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPip
  • 1,270 posts
  • Gender:Male
  • Location:UK
  • Interests:Computers, PHP, HTML, Snow, Food!
  • myCENT:81.31
  • Spam Patrol

Posted 09 April 2009 - 03:13 PM

Yeah a great tutorial/guide, I found out how to do this with a video I found Youtube.com I think it was Jimmyrcom or something like that. However this is very easy to do the only problem I had was port forwarding if you also get stuck there go to google and search "How to port forward on (Router/modem) put in your router make and moddel.
I use this now also to show my scripts off to people before they buy them, This system is very effective I recommend you try it.

#63 fadillzzz

    Member [Level 3]

  • Kontributors
  • PipPipPipPipPipPip
  • 95 posts
  • Gender:Male
  • myCENT:34.58

Posted 11 April 2009 - 12:14 AM

View Postsnlildude87, on Apr 18 2005, 01:43 AM, said:

In this tutorial, I'm going to show you how to test your PHP pages without the Internet or uploading the files to your trap17 server. This tutorial is similar to doom's, but the links he provided does not work, so I decided to make my own tutorial with working links. The program that I will be using for this tutorial is called XAMPP. XAMPP is a modification of the popular Apache server, and I'm using XAMPP because of its simplicity to install as well as maintain. The current version of XAMPP is 1.4.13 and it has the following bundled in the download:


The Blurb

Every web site on the internet, including your website at trap17, is hosted on some sort of server. What is a server you ask? A server is basically a central processing unit (CPU), similar to the one you have next to you, that has a program installed, usually Apache or its variants. The main job of the server is to serve up web pages for you to enjoy.

How do I get a XAMPP?

Simple. The following are direct links to download XAMPP from various servers:

* http://kent.dl.sourceforge.net/sourceforge...3-installer.exe
* http://cogent.dl.sourceforge.net/sourcefor...3-installer.exe
* http://heanet.dl.sourceforge.net/sourcefor...3-installer.exe
* http://ovh.dl.sourceforge.net/sourceforge/...3-installer.exe
* http://nchc.dl.sourceforge.net/sourceforge...3-installer.exe
* http://optusnet.dl.sourceforge.net/sourcef...3-installer.exe
* http://easynews.dl.sourceforge.net/sourcef...3-installer.exe
* http://switch.dl.sourceforge.net/sourcefor...3-installer.exe
* http://mesh.dl.sourceforge.net/sourceforge...3-installer.exe
* http://belnet.dl.sourceforge.net/sourcefor...3-installer.exe
* http://jaist.dl.sourceforge.net/sourceforg...3-installer.exe
* http://puzzle.dl.sourceforge.net/sourcefor...3-installer.exe
* http://citkit.dl.sourceforge.net/sourcefor...3-installer.exe

If one doesn't work, try the others. Posted Image

Once you have downloaded XAMPP (25 MB), run the installer and install it in c:\apachefriends. Whatever name you choose, you have to keep in mind that XAMPP has to be in an upper directory, so c:\program files\apachefriends will not work.

Congratulations! You now have your very own non-working server on your computer.

Make it Work - The Harder Way

Go to My Computer -> C: -> apachefriends -> xampp if you chose to install it in the apachefriends directory. You should see several files and folders in the xampp folder. The first thing to remember is not to get intimidated because the file names are very descriptive, so they're easy to understand.

To start your server, find the file name called "php-switch.bat" and double click on it. Type "5" (without quotes), so the window should look somewhat like this:
CONSOLE

#----------------------------------------------------------------------#

# Copyright © 2002-2004 Apachefriends #

#----------------------------------------------------------------------#

# Authors: Kay Vogelgesang <kvo@apachefriends.org> #

# Oswald Kai Seidler <oswald@apachefriends.org> #

########################################################################



The working version in XAMPP is => PHP 5 <=
The verwendete Version in XAMPP ist => PHP 5 <=


Type number or 'x' (exit) for selecting your choice!
Gebe nun Nummer oder 'x' (exit) zum auswaehlen ein!

4) Switching to PHP 4 (zu PHP 4 wechseln)
x) Exit (Beenden)
5_
You now have PHP running on your computer! Posted Image Now, press any key to exit that window.

To get Apache running on your computer, find the file called "apache_start.bat". You now have Apache running on your computer. Congratulations! Posted Image The most important part is running or testing PHP scripts on your computer.

Making it Work - The Easier Way

Go to your My Computer -> C: -> apachefriends -> XAMPP -> Double click on xampp-control.exe (should be the last file in that directory) -> Click the first two "Start" buttons (the last two are optional) -> Click on the X on the top right hand corner of the application.

Congratulations! You have just started Apache with PHP and MySQL on your computer in less than 5 minutes, and best of all, the big black console/DOS screen is not there. Posted Image

Running PHP Scripts on your Computer

Go to your xampp folder which should already by opened. Find the folder called "htdocs" and double click on that. Right click inside that folder -> New -> Text Document (Posted Image)-> Rename the new file to "testphp.php" (without quotes) -> Click Yes -> Double click on testphp.php -> Type:
<?php echo "Whee, PHP!"; ?>
Save the file (Ctrl + S).

Open your favorite browser and type in "http://localhost/testphp.php" in the address bar. If you see "Whee, PHP!", then you did everything right! If not, then either I screwed up or you did not follow my instructions. Post whatever problems you have and I'll try to fix it.

You can also allow friends to see your PHP script. Simply find your IP address, and give them this URL: http://youripaddress/testphp.php. If your friend complains that it's taking forever, chances are you have a slow internet connection. The faster your internet connection -> the faster your friends will be able to view the pages hosted on your computer. Now you know why most servers demand a fast internet connection such as T1. Posted Image

Closing Apache

Go back to the xampp folder and find a file called "apache_stop.bat" and click on it. Apache is now turned off on your computer!

Frequently Asked Questions

Q: Will .htaccess work?
A: Yes! Open a new file in Notepad and save it as a ".htaccess" file. Now, go to your File Manager in your cPanel. Go into the public_html folder and find a file named .htaccess. Click on it. On the right pane, you will see a list of things you can do with that file. Click on Edit File and a window should pop up. Copy everything in that box and paste it in the opened Notepad. Save Notepad (Ctrl + S).

Q: Why is .htaccess important?
A: No, but you can do some pretty cool stuff with it. For example, you can make custom 404 pages or, my favorite, you can make your server treat a file name of your choice to parse as PHP, so a file ending in .html will be parsed as a PHP script. This is really cool because it gives members the impression that your site is edited by hand.

Q: How do I make my server parse .html files as a .php file?
A: Make a .htaccess file as shown in the first question in this FAQ. Append this line to your .htaccess file:
AddType application/x-httpd-php .html .htm
In fact, ".html .htm" in the code above can be anything your heart desires. You can go all out and replace ".html .htm" with ".yourname", so pages ending in ".yourname" will be parsed as if it were a PHP script. Posted Image You can also make your server parse files with no extensions as a PHP script. Just append this line to your .htaccess file:
DefaultType application/x-httpd-php
I like this, too, because it looks as if you store EVERY page in different folders. Posted Image

Q: Can't I just exit out of Apache without clicking on apache_stop.bat?
A: NO! For some reason, this is very bad and will cause problems. apache_stop.bat has to run in order to shut down Apache correctly.


That's all for now! Remember, if you have any questions about this tutorial, feel free to post it, and I'll do my best to answer it. Posted Image

Edit: Added "Making it Work - The Easier Way" Posted Image
thank you very much for the nice tutorial snlildude87

#64 CitizenErased

    Newbie [Level 1]

  • Kontributors
  • Pip
  • 10 posts
  • Gender:Male
  • myCENT:93.30

Posted 14 May 2009 - 09:33 AM

Thanks alot, this tutorial will surely save development time!

#65 frozen.fish

    Super Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 348 posts
  • Gender:Male
  • Location:Everywhere
  • myCENT:42.64

Posted 19 May 2009 - 12:20 PM

you can also use wamp which is pretty straight forward..

#66 iGuest

    Hail Caesar!

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,876 posts
  • Interests:Trap17 Free Web Hosting, No Ads

Posted 11 November 2009 - 04:20 AM

Can not run php on my computerTest Your Php Pages W/o Upload/internet I have follow your instruction but after I test my php page it doesn't work at all. One thing that I want to point out is about the process to start my server. You said: To start your server, find the file name called "php-switch.Bat" and double click on it. Type "5" (without quotes),.. ... But after I double click on php-switch.Bat it didn't appear like you at all. It just ask me to press any key to continue... Then after I press number 5 the window was close. I don't know it is the problem.

Thanks in advance

-reply by Chantrea

 



#67 rmills

    Member [Level 1]

  • Kontributors
  • PipPipPipPip
  • 54 posts

Posted 16 November 2009 - 02:26 AM

Great tutorial, makes it easier than uploading then checking the changes

#68 Guest_Paul_*

  • Guests

Posted 07 April 2011 - 09:16 PM

Dear To whom it may concern

PROBLEM IN BOLD:

Not Found

The requested URL /testphp.php was not found on this server.
Apache/2.0.53 (Win32) mod_ssl/2.0.53 OpenSSL/0.9.7f PHP/5.0.4 Server at localhost Port 80

I done everything that you showed but unfortunately it is not work, i'm sure the flaw is on my side.

I have a 64 bit, i have no past expereince with this nor PHP but i'm starting to learn PHP and want to test my code etc...

I haven't got mysql or anything nor i don't know how it work.

So if you could please help me, id be greatful

Thanks,
Paul




Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users