3

How can I test out PHP scripts on my local computer before uploading them? I'm a bit new to this so sorry for the simplicity. My domain provider's installed PHP version is 5.2.2 if that helps.

EDIT: Alright people keep your pants on I'm running Windows 7 x64

  • PC, mac, or linux? – Jeff Jun 05 '11 at 20:58
  • 5
    Google "how to install PHP" and install it. Do a few tutorials on PHP. –  Jun 05 '11 at 21:00
  • @Cracker, the lazy mans way - let 5 other people do the Googling for you ;) –  Jun 05 '11 at 21:04
  • People are attempting to close as "off-topic". While it may be a duplicate, it most certainly is not off-topic. –  Jun 05 '11 at 21:04
  • 1
    I don't understand why this got downvotes. If it's a duplicate, then mark it as one. If it belongs somewhere else, mark it as such. However, to me, this doesn't deserve to be downvoted as it is a clear (though we could help even further if we knew the operating system) and true question. – Shaz Jun 05 '11 at 21:05
  • @Shaz: I guess the answer to this question could have been easily found by doing a bit of research by using Google. When you hover the downvote button the tooltip shows "This question does not show any research effort" and I thought this question does not show any research effort so downvoted it. If this is not the correct reason to downvote then tell me... I will undo my downvote. –  Jun 05 '11 at 21:12
  • @Shaz: "How do I install PHP" is not a programming question. – Wooble Jun 05 '11 at 21:17
  • @Cracker I say if it's a serious question and has not been asked before then there is no need to downvote. Further and future questions that are asked can simply be closed as a duplicate of the first. Now, if the OP spoke in l33t or had bad grammar, this shows he/she is obviously lazy. But the OP of this question seems to be serious and would appreciate answers describing how to do something and possibly gather info on which way is best. @Wooble: Then it belongs [somewhere else](http://webmasters.stackexchange.com/); still doesn't deserve a downvote. – Shaz Jun 05 '11 at 21:18
  • @Shaz: I wouldn't judge anyone by their grammar. Anyways I am new to SO. So I will go with you. But I'm not able to undo as my vote has been locked. If someone can edit the question I will undo my downvote. –  Jun 05 '11 at 21:22
  • I didn't downvote, but I also didn't vote to migrate to a site where it will be closed anyway. – Wooble Jun 05 '11 at 21:34
  • I didn't downvote, but Cracker is right. Copy and paste his question into Google and you get links to WAMP-- this is evidence that he hasn't even tried Google. If he did try Google but is still confused, his question should be more specific to indicate what exactly is confusing. – Jeff Jun 05 '11 at 21:35
  • Please migrate this to superuser.com. It's really not server related – Martin M. Jun 05 '11 at 23:24

4 Answers4

6

Would recommend WAMP, because it allows you to easily install multiple versions of PHP, Apache and MySQL.

Znarkus
  • 1,087
  • 2
  • 18
  • 32
  • Thanks for your help. I downloaded WAMP and installed PHP 5.2.2 but it has an orange W logo and when I try to click "Put Online" it gives an error: The service has not been started. Even after I select "Start all Services". Any Ideas? –  Jun 05 '11 at 22:28
  • @Pete Sorry for late reply. Have you clicked Start All Services? If it doesn't start try starting Apache in cmd. Do this by opening cmd and drag httpd.exe into it. You can find httpd.exe in `C:\wamp\bin\apache\Apache2.2.11\bin`. Should show you any startup errors. – Znarkus Dec 02 '11 at 11:47
4

XAMPP free is a cross platform, Apahce , PHP, and MySQL application stack:

You can get it from here http://www.apachefriends.org/en/xampp.html

It avalible for Mac, Windows and Linux

Petah
  • 650
  • 2
  • 13
  • 24
  • also a word of advice, don't go for the recent versions of XAMPP. If you want a stable install, go for the 1.7.3 release specifically; it's the latest release that actually runs without a crapton of errors on several machines that I own. –  Jun 05 '11 at 21:12
1

Install a web server and PHP. One of the most popular web servers is Apache.

For Windows, there's a package called XAMPP that includes Apache, MySQL, PHP, and some other minor things, and it's fairly easy to set up.

For Mac OS X, there's also MAMP.

For Linux, you can usually use your package manager. For example, if you're using Ubuntu (or probably Debian as well):

sudo apt-get install apache2
sudo apt-get install php5
sudo apt-get install mysql-server
sudo apt-get install php5-mysql
sudo apt-get install libapache2-mod-php5
sudo apache2ctl restart
  • XAMPP is available for Windows as well as Linux, Mac, and Solaris. :) – Shaz Jun 05 '11 at 21:10
  • what are all the `sudo` commands I never figured that out.. I recently downloaded the new version of Ubuntu and duel booted my computer –  Jun 05 '11 at 21:53
  • 1
    @Pete: `sudo` temporarily changes you to `root`. `root` is the superuser, and can do everything. As a normal user, you do not have the necessary privileges to install software with `apt-get`. –  Jun 05 '11 at 22:04
  • @Shaz: I realize that, but in my experience, it works best on Windows, and the other options I listed work better on their respective platforms. –  Jun 05 '11 at 22:06
1

MAMP for Macs - http://www.mamp.info/en/index.html

or

XAMPP for Windows - http://www.apachefriends.org/en/xampp.html

Make it really easy to get it installed and running.

preinheimer
  • 121
  • 4
  • 1
    If you're on a Mac, Apache & PHP come preinstalled -- http://foundationphp.com/tutorials/php_leopard.php – Jeff Jun 05 '11 at 21:01
  • They do, but to be honest I install MAMP anyways. I find it a bunch easier to manage, the PHP pre-installed is also rather crappy. You also end up with issues when you install an OS update where your PHP changes in the background which can be an interesting bug to track down. – preinheimer Jun 05 '11 at 21:02
  • 'rather crappy'? PHP is PHP. – Jeff Jun 05 '11 at 21:03
  • The libraries it's built against, and the included extensions have caused me issues. This may be better with snow leopard, but earlier versions didn't include much beyond core. – preinheimer Jun 05 '11 at 21:07