Locked lesson.
About this lesson
How to code PHP on your local computer.
Exercise files
Download this lesson’s exercise file.
Setting up a Local Development Environment with XAMPP.docx60.1 KB
Quick reference
Setting up a Local Development Environment on Windows
You can run PHP Locally using Xampp.
When to use
Normally, we'll use a cloud development environment. But if you want to run PHP locally, use Xampp.
Instructions
To download and install Xampp, head over to https://www.apachefriends.org
You can download versions for Windows, Linux, or Mac.
Hints & tips
- https://www.apachefriends.org
- 00:04 In this video,
- 00:05 I want to talk about setting up a local development environment.
- 00:08 Like I said in the last video, PHP is a server-side language.
- 00:11 Which means you need a server.
- 00:12 And if you're taking this course, you probably don't have a server, or
- 00:15 a web hosting account, or anything like that.
- 00:17 Luckily there's a tool that sort of mimics those things on your local computer.
- 00:20 And that's what we're going to talk about in this video.
- 00:22 So head over to Google and type in XAMPP, it's X-A-M-P-P.
- 00:26 And it looks like XAMPP, but I think they pronounce it champ or shamp.
- 00:30 You'll see this apachefriends.org and Apache is a popular web server.
- 00:35 So you could see this is the tool we're going to download.
- 00:37 It's completely free, you can use it for Windows, Linux or Mac OS X.
- 00:41 So just click the Download link, pick the one that you want,
- 00:43 I'm going to go Windows.
- 00:44 And I'm just going to save this to my Desktop, so we click Save.
- 00:48 Now it's 110 megabytes.
- 00:49 So it might take a little bit of time to download based on how fast your Internet
- 00:53 connection is.
- 00:54 But once it's downloaded, you can either click it right here in your web browser.
- 00:56 Or you can navigate to your desktop wherever you downloaded it and
- 01:00 double click it.
- 01:01 And this will bring up the XAMPP installer.
- 01:06 A couple of messages, click through them.
- 01:08 And here we have just the basic installer, click Next.
- 01:11 Now here's all the different things you can install.
- 01:13 At MySQL, that's a database thing.
- 01:15 FileZilla is a FTP server.
- 01:17 We don't need any of these things.
- 01:19 I can unclick all of these.
- 01:20 Now it's asking which programming languages do we want,
- 01:23 PHP or Perl, we just want PHP.
- 01:25 And these are all database things and email things, we don't need any of them.
- 01:28 So just unclick all of those and click Next.
- 01:31 Now remember this directory, because we're going to need this later on.
- 01:34 I'm just going to save it in C:\xampp, click Next.
- 01:38 And click that, click Next, Next again.
- 01:41 And just walk through this, very simple, and it'll install this pretty quickly.
- 01:47 It may take a little bit longer based on your computer, it's unpacking and
- 01:50 installing all kinds of different things.
- 01:52 So just give it a minute if it takes a while, no big deal.
- 01:56 Okay, setup has finished installing it on your computer.
- 01:59 Do you want to to start the Control Panel now?
- 02:00 Sure, Finish, click your language, and here we go.
- 02:04 So this is the main control panel here and what we want is Apache.
- 02:08 So if we click Start, you could see it's yellow, it's starting up.
- 02:12 Now it's green, it's up and running.
- 02:14 And it's running on port 80, you don't really need to know what that is.
- 02:16 But if you come back to your web browser and
- 02:18 just type in localhost, you can see that it's up and running.
- 02:22 We have this sort of dashboard.
- 02:23 So go to your Start menu and click on your My Computer and click your C drive.
- 02:27 And navigate to that directory where we install it, it's xampp.
- 02:31 And look through here, we want a folder called htdocs.
- 02:34 And if we click on this,
- 02:35 now this is where you're going to save all of your PHP files from now on.
- 02:38 And you see this dashboard that corresponds to this dashboard thing.
- 02:42 Let's come back here and really quickly just create a quick PHP file and
- 02:45 I'm going to click New and Text Document.
- 02:49 Now let's call this test.php and get rid of the .txt thing.
- 02:53 All PHP files will end in .php, Yes.
- 02:56 Now if we just open this, I'm going to open it in my Sublime Text editor.
- 03:00 I'm just going to create some real quick PHP.
- 03:02 Remember in the last video, this is how we do PHP.
- 03:06 So I'm going to go echo "Hello world!"; and come up here and
- 03:12 click File > Save As to make sure it's ended in the .php extension.
- 03:18 Click Save, Yes.
- 03:21 Now come back to our web browser and get rid of this dashboard.
- 03:23 And just type in the name of that file, test.php, and you see Hello World.
- 03:27 There's our file.
- 03:28 And that means PHP is up and running and everything is good.
- 03:30 So that's the XAMPP PHP local development environment.
Lesson notes are only available for subscribers.