Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Samer_J's avatar

Homestead not using latest PHP version?

So I recently setup Laravel 5.3 using Homestead. Everything is pretty much working fine. I've followed the installation guide in the Laravel documentation and I have begun working on my first project.

I now want to implement the Laravel authentication system, so I cd into my project folder and run the "php artisan make:auth" command.

But it always throws this error:

PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in C:\Users\Samer\Desktop\Projects\mgn\artisan on line 31

I looked up the error and found that it's caused by having an old PHP version, so I ran the "php -v" command and I got the following:

PHP 5.4.3 (cli) (built: May 8 2012 00:51:31) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies

I'm thinking this could be because I setup WAMP back in 2012 when I first started developing in PHP. If that's the case, how do I get it to use PHP 7.1? Shouldn't PHP 7.1 be included with Homestead? How do I get it to use the latest version of PHP by default?

Any help would be greatly appreciated. Thanks!

0 likes
2 replies
tomopongrac's avatar
Level 51

you need to perfom command

php artisan make:auth

in homestead virtual machine

1 like
bgies's avatar

Just to clarify @tomi answer... if you run the command in a Windows terminal session, you are using the version of PHP on your windows box.... if you want to use the Homestead PHP version, you need to terminal into Homestead (Putty works great).

Please or to participate in this conversation.