Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question

migrated from stackoverflow.com Jun 5 '11 at 22:30

This question came from our site for professional and enthusiast programmers.

closed as off topic by Ben Pilbrow, sysadmin1138 Jun 6 '11 at 0:04

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
PC, mac, or linux? –  Jeff Jun 5 '11 at 20:58
5  
Google "how to install PHP" and install it. Do a few tutorials on PHP. –  Cracker Jun 5 '11 at 21:00
    
@Cracker, the lazy mans way - let 5 other people do the Googling for you ;) –  Nideo Jun 5 '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. –  icktoofay Jun 5 '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 5 '11 at 21:05
show 7 more comments

4 Answers

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

share|improve this answer
    
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 '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 2 '11 at 11:47
add comment

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

share|improve this answer
    
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 '11 at 21:12
add comment

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
share|improve this answer
    
XAMPP is available for Windows as well as Linux, Mac, and Solaris. :) –  Shaz Jun 5 '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 –  Pete Allport Jun 5 '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. –  icktoofay Jun 5 '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. –  icktoofay Jun 5 '11 at 22:06
add comment

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.

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