Can't install Sage with composer create-project due to php version error


#1

Trying to install Sage 9 via composer into a wordpress install running php 7.1.4 with:

composer create-project roots/sage sagetest dev-master

but am getting this error:

Could not find package roots/sage with version dev-master in a version installable using your PHP version 5.6.30

phpinfo(); confirms I am running php 7.1.4

Thoughts on this? Thanks in advance


Composer sage install doesn't ask for dependencies
#2

Is your phpinfo output the same as your PHP CLI though? What happens when you try php -v?


#3

Oh damn, yeah, that’s the issue. :confused:

Thanks!


#4

Hi @richard @benword
I have the same issue i have php -v 5.6.30 so i have tried to install php 7 on my system with :
curl -s https://php-osx.liip.ch/install.sh | bash -s 7.1

but i still get php -v 5.6.30 in my terminal

also, in my .bash_profile i have those lines :

export PATH="/Applications/MAMP/Library/bin:$PATH"
alias composer="php /usr/local/bin/composer.phar"
alias wpinstall="~/Scripts/wpinstall.sh"

export NVM_DIR="/Users/Mecanographik/.nvm"

[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"  
# This loads nvm
#source ~/.bashrc

export PATH="$HOME/.yarn/bin:$PATH"

any help would be really appreciated ! :sweat_smile:


#5

Hi @benword
Nevermind i have managed to fix my problem with brew using this ressource :

brew update && brew upgrade
brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
brew unlink php56  
brew install php71

than in your terminal, type:
export PATH=/usr/local/php5/bin:$PATH

now i have php 7.1 version on my system and the following command works :wink::rocket:

composer create-project roots/sage your-theme-name dev-master

Hope it helps someone else


#6

Have same issue.

php -v
PHP 7.0.22-0ubuntu0.16.04.1 (cli) ( NTS )

composer create-project roots/sage your-theme-name dev-master runs to:

Installing roots/sage (dev-master b4421be2696bd6021a11eb6893bb6fbb8a949d15)
  - Installing roots/sage (dev-master master)
    Cloning master

Created project in your-theme-name
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for illuminate/support v5.4.27 -> satisfiable by illuminate/support[v5.4.27].
    - illuminate/support v5.4.27 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
  Problem 2
    - Installation request for squizlabs/php_codesniffer 2.9.1 -> satisfiable by squizlabs/php_codesniffer[2.9.1].
    - squizlabs/php_codesniffer 2.9.1 requires ext-simplexml * -> the requested PHP extension simplexml is missing from your system.
  Problem 3
    - illuminate/support v5.4.27 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - illuminate/console v5.4.27 requires illuminate/support 5.4.* -> satisfiable by illuminate/support[v5.4.27].
    - Installation request for illuminate/console v5.4.27 -> satisfiable by illuminate/console[v5.4.27].

  To enable extensions, verify that they are enabled in those .ini files:
    - /etc/php/7.0/cli/php.ini
    - /etc/php/7.0/cli/conf.d/10-opcache.ini
    - /etc/php/7.0/cli/conf.d/10-pdo.ini
    - /etc/php/7.0/cli/conf.d/20-calendar.ini
    - /etc/php/7.0/cli/conf.d/20-ctype.ini
    - /etc/php/7.0/cli/conf.d/20-exif.ini
    - /etc/php/7.0/cli/conf.d/20-fileinfo.ini
    - /etc/php/7.0/cli/conf.d/20-ftp.ini
    - /etc/php/7.0/cli/conf.d/20-gettext.ini
    - /etc/php/7.0/cli/conf.d/20-iconv.ini
    - /etc/php/7.0/cli/conf.d/20-json.ini
    - /etc/php/7.0/cli/conf.d/20-phar.ini
    - /etc/php/7.0/cli/conf.d/20-posix.ini
    - /etc/php/7.0/cli/conf.d/20-readline.ini
    - /etc/php/7.0/cli/conf.d/20-shmop.ini
    - /etc/php/7.0/cli/conf.d/20-sockets.ini
    - /etc/php/7.0/cli/conf.d/20-sysvmsg.ini
    - /etc/php/7.0/cli/conf.d/20-sysvsem.ini
    - /etc/php/7.0/cli/conf.d/20-sysvshm.ini
    - /etc/php/7.0/cli/conf.d/20-tokenizer.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

#7

Please read the post above yours


#8

But I already have “php”: “>=7”, mentioned by php -v


#9

Please READ the error you pasted

You’re missing PHP extensions


#10

Thank you, guys. Sharing my expirience in Ubuntu Linux.
Composer has obsolete PHP_CodeSniffer version.

sudo apt-get install nfs-kernel-server
sudo apt-get update && sudo apt-get install php-mbstring
sudo apt install php-pear && sudo pear install PHP_CodeSniffer

#11

Some of these have been depreciated. A helpful, more recent blog post here:

https://andygrunwald.com/blog/migrate-your-local-php-7.2-setup-to-homebrew-v1.5./

Came across this problem this morning on a fresh install of Sage where the error similar to cannot satisfy requirements because I had php7.1 locally and needed greater than that.

Also didn’t realise composer was looking at my system’s php, not the virtual machine’s…

Hope this helps.