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?

ux.engineer
  • 10,082
  • 13
  • 67
  • 112
  • composer create-project laravel/laravel=YOUR_VERSION your-project-name --prefer-dist – Mate Apr 05 '20 at 18:17
  • Does this answer your question? [Installing specific laravel version with composer create-project](https://stackoverflow.com/questions/23754260/installing-specific-laravel-version-with-composer-create-project) – Mate Apr 05 '20 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. – ux.engineer Apr 05 '20 at 18:42
  • What have you tried to debug the problem? – Nico Haase Apr 06 '20 at 09:22
  • Tried to see what global composer packages was installed but there was no global Laravel package installed. – ux.engineer Apr 06 '20 at 09:33

1 Answers1

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).

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
  • 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. – ux.engineer Apr 05 '20 at 18:48
  • 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. – ux.engineer Apr 05 '20 at 18:48
  • 1
    L7 requires PHP 7.2+ which you do not have – Marcin Orlowski Apr 05 '20 at 19:05
  • 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. – ux.engineer Apr 05 '20 at 19:15
  • 2
    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 – Marcin Orlowski Apr 05 '20 at 19:55