0

i've been install PHP7.2 on my PC but when i try to php -v it's show me error like this

bash: /usr/local/bin/php: No such file or directory

and then i try to type php7.2 -v it's works

Anyone have solution so when i type php -v it's show me php7.2 ?

  • What does type -a php say? – steeldriver May 14 at 0:00
0

Simply install the php alternative package (https://packages.ubuntu.com/bionic/php)

sudo apt install php

And you will get new symbolic links

~$ ll /usr/bin/php7.2 
-rwxr-xr-x 1 root root 4.7M Apr 18 16:12 /usr/bin/php7.2*

~$ ll /usr/bin/php
lrwxrwxrwx 1 root root 21 Mar  7 17:05 /usr/bin/php -> /etc/alternatives/php*

~$ ll /etc/alternatives/php
lrwxrwxrwx 1 root root 15 Mar  7 17:05 /etc/alternatives/php -> /usr/bin/php7.2*

~$ php -v
PHP 7.2.17-0ubuntu0.18.04.1 (cli) (built: Apr 18 2019 14:12:38) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.17-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies

~$ php7.2 -v
PHP 7.2.17-0ubuntu0.18.04.1 (cli) (built: Apr 18 2019 14:12:38) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.17-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies

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.