I'm running PHP 7 on my box. The Laravel project I'm working on is also coming from a PHP 7 dynamic, so I don't know where the PHP 5.6.4 is coming from, but from what I've been able to determine, the error that I'm getting is because of PHP mismatch.
How do I fix it?
LaravelInstallationPHP
Last Comment
Bruce Gust
8/22/2022 - Mon
Chris Stanyon
Hey Bruce,
When you run a WAMP stack, you have 2 versions of PHP - the version your website runs and the version the command line runs (CLI). When you run php -v, it will give you the version of PHP that is referenced in your PATH environment. It is possible that you have more than one version of PHP on your system, and the PATH is pointing to an older version.
Have a look in your WAMP directory, under a folder called bin. You'll probably see several versions of PHP in there, including your 5.6.4 plus your v 7.x.x. From a command prompt, type 'path' and press enter. You'll probably see that you have the old 5.6.4 path referenced in there.
You have a few choices. You can either change the path to point to the correct version (head to your Control Panel | System | Advanced System Settings | Environment Variables) , or you can fully qualify the php exe when you run your artisan commands:
If you're using WAMP server, you may also be able to change the CLI version directly (depending on your version of WAMPServer). Right-click on the WAMP icon in your task bar, select Tools, and you'll see a menu item that says "Change PHP CLI Version" - just select the v7 version).
FYI - the error you're getting is because in the helpers.php file, they're using the null coalescing operation ( a double ?? ) which only works in v7
Bruce Gust
ASKER
Hey, Chris!
I changed my PATH so I'm running PHP 7
This is my laptop. I'm on vacation and I was just hoping to get a little more work done. By the time I get this figured out, I'll be back home. But it's still healthy to understand what's going on.
When you run a WAMP stack, you have 2 versions of PHP - the version your website runs and the version the command line runs (CLI). When you run php -v, it will give you the version of PHP that is referenced in your PATH environment. It is possible that you have more than one version of PHP on your system, and the PATH is pointing to an older version.
Have a look in your WAMP directory, under a folder called bin. You'll probably see several versions of PHP in there, including your 5.6.4 plus your v 7.x.x. From a command prompt, type 'path' and press enter. You'll probably see that you have the old 5.6.4 path referenced in there.
You have a few choices. You can either change the path to point to the correct version (head to your Control Panel | System | Advanced System Settings | Environment Variables) , or you can fully qualify the php exe when you run your artisan commands:
Open in new window
If you're using WAMP server, you may also be able to change the CLI version directly (depending on your version of WAMPServer). Right-click on the WAMP icon in your task bar, select Tools, and you'll see a menu item that says "Change PHP CLI Version" - just select the v7 version).FYI - the error you're getting is because in the helpers.php file, they're using the null coalescing operation ( a double ?? ) which only works in v7