Setting Up Vagrant Box0:00
Okay, over the next handful of videos, I'm going to show you what you need to know about PHP 7.1, and what will be relevant to you. Now, to demonstrate these examples, I'm going to use Rasmus' Vagrant box. So you can go to the GitHub page here, if you'd like to work along, and it will show you the installation. Let's try it out. Let's clone it, CDN, and then do a vagrant up. Now, of course, if you're going to do this, you need to have both Vagrant and VirtualBox installed. You can go to their respective websites.
installed. You can go to their respective websites. You can have that all set up in just a few minutes. And likely, you already have done that. Now for the bridge, yeah, just use whatever option connects to the internet for you. In my case, I'm using Wi-Fi, so I will do number one. Okay, so with that done, we should now be able to do vagrant ssh. And let's do a php -v. Yeah, by default, we have PHP 7. Now one cool thing they offer is you can switch to basically any recent version.
Switching to PHP 7.10:53
Yeah, by default, we have php 7 dev. Now one cool thing they offer is you can switch to basically any recent version. You can use this new PHP helper. So let me use one that doesn't exist so that we can see the usage here. Yeah, you can choose 7.1, of course, which is what we will use, all the way down to 5.3. So they're all included for us. So what's nice is I can say I want to use 7.1, and it will automatically do the symlink for you. That way, if we now say php -v, it points to 7.1. However, it looks like we have an old build here.
Updating PHP 7.1 Build1:22
That way, if we now say php -v, it points to 7.1. However, it looks like we have an old build here. So you can see it was built in October 22nd. So I'm thinking that some things won't be available to us. For example, let me open up an interactive shell. And quickly, I'll try the destructuring that I'm going to show you in the next lesson. Yeah, if we run that, we get an error, even though this is valid code in PHP 7.1. So what I'm going to do is make sure I update this to the latest build. I can do that by saying, make php, and specifically the 7.1 build. Okay, I'm going to give that just a minute, and I will fast forward.
I can do that by saying, make php, and specifically the 7.1 build. Okay, I'm going to give that just a minute, and I will fast forward. All right, so that took a good five minutes to run on my machine, but I think we should be okay now. So I'm going to open up the interactive shell. It looks like it's trying to reference some extensions that haven't been loaded. I'll fix that in just a second. But if we do try out $name equals Joe, don't worry about the syntax for now. I'll show you in a bit. And we dump it.
Fixing Extension Warnings2:17
I'll show you in a bit. And we dump it. Everything should work. And we're all set to go. The only remaining thing I want to do, yeah, let's take a look at this warning that we're getting. It looks like it's not affecting anything, but it's having trouble loading an extension. I assume it's because these aren't installed. So let's find our configuration file here. As you may know, you can do php -i to load basically PHP info here, but you could always
So let's find our configuration file here. As you may know, you can do php -i to load basically PHP info here, but you could always search after that. So like, let's find the loaded configuration file, and yeah, we're getting all these warnings, but here it is. Okay, let's open up that file. And yeah, I'm assuming we have to build each of these since I changed everything. I'm not sure, but we're not making use of any of them. So I can comment them out. And if we now try anything again, yeah, we don't get those warnings.
