2

It has been a while since I created a new project with Laravel framework. Decided to install a fresh project so opened up V7 documentation at Install Via Composer Create-Project.

First updated my global Composer installation to the newest version: composer self-update

Then ran installation with composer create-project as exampled in the docs: composer create-project --prefer-dist laravel/laravel myproject

After installation went into the directory to check Laravel's version: cd myproject && php laravel -V

Much to my surprise it had installed a much older version: Laravel Framework 5.8.37

Expected to get the newest version... Why did it install an older version, and how do I upgrade or instruct the create-project command to use the newest version?

5
  • composer create-project laravel/laravel=YOUR_VERSION your-project-name --prefer-dist Commented Apr 5, 2020 at 18:17
  • Does this answer your question? Installing specific laravel version with composer create-project Commented Apr 5, 2020 at 18:17
  • Sorry but that question has different problem, as "when you run the above command, it will grab the latest version of Laravel." – I have the opposite situation, as I was expecting to get the newest version but got a really old one. Commented Apr 5, 2020 at 18:42
  • What have you tried to debug the problem? Commented Apr 6, 2020 at 9:22
  • Tried to see what global composer packages was installed but there was no global Laravel package installed. Commented Apr 6, 2020 at 9:33

1 Answer 1

1

It looks lile your environment is insufficient for L7 (like too old PHP version, missing required extensions etc). You should ensure your environment fulfills Laravel requirements:

  • PHP >= 7.2.5
  • BCMath PHP Extension
  • Ctype PHP Extension
  • Fileinfo PHP extension
  • JSON PHP Extension
  • Mbstring PHP Extension
  • OpenSSL PHP Extension
  • PDO PHP Extension Tokenizer PHP Extension XML PHP Extension

https://laravel.com/docs/7.x/installation#server-requirements

Also keep in mind that php-cli version you use may be different from what your httpd is using (i. e. due to $PATH and multiple PHP versions are installed).

Sign up to request clarification or add additional context in comments.

5 Comments

I ran that installation command in my OSX terminal with PHP 7.1... Went on to use Laravel installer from inside Homestead which gave me Laravel 7.4.0.
If I use composer create-project inside Homestead 9.4.0 box it outputs "Installing laravel/laravel (v7.3.0)", however, after the installation php artisan -V gives me 7.4.0 and not 7.3.0 as first outputted.
L7 requires PHP 7.2+ which you do not have
That must be it then... I'd expect to Composer to notify of installation requirements having not been met and falling back to an older version.
It would only in case of missing requirements. For now it managed to figure out which L version would work on your setup. And as you did not specify exact version then it took the latest that fits

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.