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

12
  • PC, mac, or linux?
    – Jeff
    Jun 5, 2011 at 20:58
  • 5
    Google "how to install PHP" and install it. Do a few tutorials on PHP.
    – Cracker
    Jun 5, 2011 at 21:00
  • @Cracker, the lazy mans way - let 5 other people do the Googling for you ;)
    – Nideo
    Jun 5, 2011 at 21:04
  • People are attempting to close as "off-topic". While it may be a duplicate, it most certainly is not off-topic.
    – icktoofay
    Jun 5, 2011 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 5, 2011 at 21:05

4 Answers 4

6

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

2
  • 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?
    – Pete Allport
    Jun 5, 2011 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. Dec 2, 2011 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

1
  • 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.
    – Obsidian_
    Jun 5, 2011 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
4
  • XAMPP is available for Windows as well as Linux, Mac, and Solaris. :)
    – Shaz
    Jun 5, 2011 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
    – Pete Allport
    Jun 5, 2011 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.
    – icktoofay
    Jun 5, 2011 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.
    – icktoofay
    Jun 5, 2011 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.

4
  • 1
    If you're on a Mac, Apache & PHP come preinstalled -- foundationphp.com/tutorials/php_leopard.php
    – Jeff
    Jun 5, 2011 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. Jun 5, 2011 at 21:02
  • 'rather crappy'? PHP is PHP.
    – Jeff
    Jun 5, 2011 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. Jun 5, 2011 at 21:07