From the course: PHP for WordPress

Setting up a local environment - PHP Tutorial

From the course: PHP for WordPress

Start my 1-month free trial

Setting up a local environment

- [Instructor] Before we get started with PHP, let's set up a Local development environment. This will allow you to write PHP on your own computer without messing with a live site or servers. For that task, we'll be using Local by Flywheel. It's free and cross-platform, so you can use it on Windows or Mac. It's also built for WordPress development. Go to localwp.com and download the installer. Then, go through the installation process. During that process, you'll need to put in your computer's password a few times. This is so Local can install software integral to creating a web server on your computer. Once the installation is complete, we're going to install two sites, one with and one without WordPress. First, the WordPress site. You can click on the Create a New Site button that's in the middle of your Local screen, or you can click on the white plus button that is in the bottom left-hand corner. First you'll need to give your site a name. I'm going to call mine WordPress. Then you'll be asked to choose your environment. You can choose the preferred settings or come up with custom ones on your own. We'll stick with the preferred settings for now. Next, you'll enter a username and password. Once you do that, go ahead and click Add Site, and Local will spin up a new site for you. You'll likely be prompted to put in your password a couple more times here. We're going to leave this one alone for a bit, and instead go through the installation process again to create a site with no WordPress website on it. So we'll click the white button again, and we'll call this one No WordPress. We'll stick with our preferred settings, and we'll add the same username and password, though it won't matter for this site. Then we'll click Add Site and Local will go through the installation process again. And now, we want to have a clean environment where we can write some PHP code without the WordPress files getting in the way. So to do that on your No WordPress installation, right-click and select Reveal in Finder, or whatever the equivalent is in Windows. And then you'll be brought to the place where your local sites are stored. Click No WordPress, and then App, then Public, and these are all of the WordPress files. We're going to select them all and then delete them. Now we have an empty directory to work in. With that, you're ready to start learning PHP. Let's get to it.

Contents