2

I cannot run artisan because of some weird parse error.

$ php artisan serve
Parse error: parse error, expecting "identifier (T_STRING)"' or
"variable (T_VARIABLE)"' or '{'' or '$'' in
/Library/WebServer/Documents/artisan on line 31

So I figure I need to run composer install, but then I get this:

Your requirements could not be resolved to an installable set of
packages.

Problem 1
 - This package requires php >=5.5.9 but your PHP version does not satisfy that requirement.   Problem 2
 - classpreloader/classpreloader 2.0.0 requires php >=5.5.9 -> your PHP version does not satisfy that requirement.
 - classpreloader/classpreloader 2.0.0 requires php >=5.5.9 -> your PHP version does not satisfy that requirement.
 - Installation request for classpreloader/classpreloader 2.0.0 -> satisfiable by classpreloader/classpreloader[2.0.0].

So I try to install php5.5 or whatever it needs which supposedly works.

$ curl -s http://php-osx.liip.ch/install.sh | bash -s 5.5 installing...
Installing package 5.5-10.8-frontenddev into root / Package
5.5-10.8-frontenddev is already installed at version
5.5.27-20150710-221744. You wanted to install version
5.5.27-20150710-221744.

So at this point, I figure I have met the requirements, but low and behold, same issue with composer install.

No idea what's going on here because it seems like this issue has been around for some time now.

5
  • You are probably using old php in cli. Check with command php -v Commented Aug 9, 2015 at 8:21
  • PHP 5.4.30 (cli) (built: Jul 29 2014 23:43:29) . Should I do something different here? Commented Aug 9, 2015 at 8:22
  • So I was right. Try to add new php to your $PATH and remove old one. And ensure your server is also running with new PHP. Commented Aug 9, 2015 at 8:24
  • Thank you. If you could be a little more specific, it would help out. Commented Aug 9, 2015 at 8:31
  • 1
    Take a look here apple.stackexchange.com/questions/107230/… or here stackoverflow.com/questions/13613313/… Commented Aug 9, 2015 at 8:37

1 Answer 1

1

The workaround is to pass --ignore-platform-reqs to your composer command.

This should work when you can run your composer using the right version of PHP, e.g.

composer install --ignore-platform-reqs

Another way is to install on macOS different PHP version by Homebrew, e.g.

brew install php56
brew install php72

Then you can link it like:

ln -vs /usr/local/opt/php56/bin/php /usr/local/bin/php56
ln -vs /usr/local/opt/php72/bin/php /usr/local/bin/php72

then you can run composer using PHP version of your choice, e.g.

php71 composer install
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.