nano .bash_aliases
alias php /usr/local/php71/bin/php
alias php=/usr/local/php80/bin/php
and add composerdont use:
alias php=’/usr/local/php72/bin/php72′
. ~/.profile
https://www.raspberrypi.com/documentation/computers/using_linux.html#the-bash_aliases-file
The .bash_aliases
File
.bashrc
also contains a reference to a .bash_aliases
file, which does not exist by default. You can add it to provide a handy way of keeping all your aliases in a separate file.
if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi
The if
statement here checks the file exists before including it.
Install if not work due to php proc_open
php -d "disable_functions=" /usr/local/bin/composer create-project --prefer-dist laravel/laravel v1
and for Composer with different PHP version:
composer -vvv about
This might help some… composer is likely to be using /usr/bin/php, consider the following:-
$ which php
/usr/bin/php
$ /usr/bin/php -v
PHP 7.1.33
$ php -v
PHP 7.2.24
$ type -a php
php is aliased to '/usr/bin/php7.2'
php is /usr/bin/php
$ which composer
/usr/local/bin/composer
As you can see our hosting has an alias to ensure the configured version of php (for webserver) is used on command line. But composer is configured to use /usr/bin/php.
The following is a workaround for the above circumstance.
Update .bash_aliases file
alias php="/usr/bin/php7.2"
alias composer="/usr/bin/php7.2 /usr/local/bin/composer"
Once logged out of terminal and logged back in…
$ type -a composer
composer is aliased to '/usr/bin/php7.2 /usr/local/bin/composer'
composer is /usr/local/bin/composer
composer is now using the correct php version.