Install VirtualBox and Vagrant0:42
install VirtualBox as well as Vagrant. Don't worry, these are mostly one-click installs, and they are free. So for VirtualBox, click on one of these links that corresponds to your machine. Next, we want to grab Vagrant and do the exact same thing and go through the installation process. You're done with that side. Next, we need to clone the repository, and that will create a PHP 7 dev directory like so. Now, we only need to do vagrant up. Now, quick note, actually, if you already have something like Laravel Homestead set up on your machine and port 8000 is taken, just take a minute and do something along the lines of homestead suspend. Okay, so let's go ahead and do a vagrant up to build our virtual machine. Now, we need to specify a network bridge. I'm fine with Ethernet or Wi-Fi, whatever you want to do. Okay, so we're all set to go. Now, in my case, I already had that image installed,
Configure Hosts and SSH1:29
Now, we need to specify a network bridge. I'm fine with Ethernet or Wi-Fi, whatever you want to do. Okay, so we're all set to go. Now, in my case, I already had that image installed, so if you're working along, it might take a couple minutes to pull that in. But once you have it, you're good to go. Next, if we switch back to the documentation, we need to update our hosts file. So, on my Mac, we'll say vi /etc/hosts. And now, down here at the bottom, I'll paste that in like so. So, let's exit out, and we should be good to go. If we list the files, you'll see your Vagrantfile and things like that, which means you can ssh into your virtual machine like so. List our files, do a php -v, and sure enough, we have PHP 7. Fairly painless, right? And also, if we go to Chrome, I should be able to visit php7.dev. And there you go. We're up and running. Now, where would our document root be? Let's just look for that real quick. Well,
Find Document Root2:16
And also, if we go to Chrome, I should be able to visit php7.dev. And there you go. We're up and running. Now, where would our document root be? Let's just look for that real quick. Well, we can see the server's document root is /var/www/default. So, if we take a look at that, /var/www/default, we should see these files, and we do. And if we cat index.php, yep, that's where we run phpinfo. Now, though, if you are somewhat familiar with Vagrant, you know that it will share files between your guest machine, your current machine, and the virtual machine. Now, by default, that will share with a Vagrant directory like so. But in our case, we want to make sure, for example, if we have a source directory within our project root, that we sync that up with the document root. We can do that through a symbolic link. So, I could say, create a symbolic link where the original file is Vagrant/source that.
Sync Files via Symlink3:04
our project root, that we sync that up with the document root. We can do that through a symbolic link. So, I could say, create a symbolic link where the original file is Vagrant source that I just created, and we will link that to /var/www/default, the document root for our installation. Now, if you run it and you get permission denied, just run it with the proper permissions. And yeah, that should do it. So, for example, if I open a new tab, and let's open this in Sublime, within the source directory here, let's create a file called index.php, and we'll say it works. All right, if we set up our link correctly, I should be able to go to that default directory, and if I list the source files, yes, sharing is in place, which means back in Chrome, I can visit the source directory and see the output. Okay, so php7 is installed and ready to go. In the next video, let's figure out what's new.
I can visit the source directory and see the output. Okay, so php7 is installed and ready to go. In the next video, let's figure out what's new.
