Symfony 4 - installation

Posted on March 27, 2018, 8:55 am by about-dev.com


I've recently tried to install Symfony 4 on my development machine and I've found out an interesting thing.

I thought that on my machine I have installed PHP 7.1 so I went to the Symfony website and get the install Symfony 4 command, hit it and ... surprise, Symfony 3.4.* was installed instead.

Steps to reproduce:

1. Get composer from the official website (if not already downloaded)

[user@my-dev blog]$ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
[user@my-dev blog]$ php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
Installer verified
[user@my-dev blog]$ php composer-setup.php
All settings correct for using Composer
Downloading...

Composer (version 1.6.3) successfully installed to: /var/www/blog/composer.phar
Use it: php composer.phar

[user@my-dev blog]$ php -r "unlink('composer-setup.php');"
[user@my-dev blog]$ ls -la
total 1824
-rwxr-xr-x  1 user www-data 1861877 Mar 20 15:46 composer.phar

2. Install Symfony 4

[user@my-dev www]$ php composer.phar create-project symfony/skeleton blog/
Installing symfony/skeleton (

 

Why do I got Symfony 3 instead of Symfony 4?

Well, because I havent't PHP 7.1 or higher :) 

From the Symfony official website: ">To create your new Symfony application, first make sure you're using PHP 7.1 or higher and have 

>Composer> installed."

My current PHP version:

[user@my-dev blog]$ php -v
PHP 7.0.22 (cli) (built: Aug  2 2017 09:39:55) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.22, Copyright (c) 1999-2017, by Zend Technologies
    with Xdebug v2.5.5, Copyright (c) 2002-2017, by Derick Rethans

What should I have had installed (I got the latest stable PHP version):

[user@my-dev blog]$ php -v
PHP 7.2.2 (cli) (built: Aug  2 2017 09:39:55) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.22, Copyright (c) 1999-2017, by Zend Technologies
    with Xdebug v2.5.5, Copyright (c) 2002-2017, by Derick Rethans

So, Symfony installer is smart enough to install a Symfony version compatible with your current setup. Maybe not what you expect to be but something to help you get the job done.


Leave a Comment:

User
Email
Website

Blog Search

Popular Blog Categories

Newsletter

Want to be informed about latest posts? Subscribe to our newsletter