5

In Magento when we run any command we use 'php bin/magento' and sometimes it runs also with 'bin/magento'

So can any one explain what is the actual difference in these commands.

12

There is no difference between these two command.

php bin/magento

php bin/magento command you are using php global variable to run command. for example if you are not set the global variable then you can give path of php like /opt/lampp/bin/php bin/magento to run the magento command.

bin/magento

bin/magento command will find the golbal php variable and use that,

Note: in both cases it will use the php variable

2

Its same things :)

But generaly adding PHP you can choose to add command line option see PHP features commandline options

php -c /custom/directory/custom-file.ini bin/magento [command]

By omitting it ... it is the default version of the system that is used

It is better to launch the magento binary with the same version as the one used with the WEB server, do not forget that in command line we are in CLI

you can see something like this on debian... depending of your compilation and version

#php -v
PHP 7.1.20-1+0~20180725103315.2+stretch~1.gbpd5b650 (cli) (built: Jul 25 2018 10:33:20) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.1.20-1+0~20180725103315.2+stretch~1.gbpd5b650, Copyright (c) 1999-2018, by Zend Technologies
    with Xdebug v2.6.1, Copyright (c) 2002-2018, by Derick Rethans

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.