Installing PHP 7 on Mac OSX so I can use Composer, why an I stuck at PHP 5.6?

General Tech Bugs & Fixes 2 years ago

0 1 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (1)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

 

I am trying to install php 7 so that I can use Composer. I am running Sierra 10.12.6. After a restart, First, I tried to run Composer with:

Mac  [508]$ composer require --dev phpunit/phpunit ^7

and I got this:

[InvalidArgumentException]                                                                               
Package phpunit/phpunit at version ^7 has a PHP requirement incompatible with your PHP version (5.6.30)

Next, I stop PHP

Mac  [509]$ sudo apachectl stop

And update PHP as shown on the PHP website:

Mac  [510]$ curl -s http://php-osx.liip.ch/install.sh | bash -s 7.0

Here is the result:

Detected macOS Sierra 10.12. All ok.
Get packager.tgz
Unpack packager.tgz
Please type in your password, as we want to install this into /usr/local
Start packager (may take some time) using /usr/bin/python2.7
downloading https://s3-eu-west-1.amazonaws.com/php-osx.liip.ch/install/7.0-10.10-frontenddev-latest.dat
downloading https://s3-eu-west-1.amazonaws.com/php-osx.liip.ch/install/7.0-10.10/frontenddev/7.0-10.10-frontenddev-7.0.30-20180623-104648.tar.bz2

Installing package 7.0-10.10-frontenddev into root /
Package 7.0-10.10-frontenddev is already installed at version 7.0.30-20180623-104648. You wanted to install version 7.0.30-20180623-104648.
Finished.

Next, I restart PHP

Mac  [511]$ sudo apachectl restart
Password:
httpd not running, trying to start
Mac  [512]$ sudo apachectl start
httpd (pid 6482) already running

Now I try composer again:

Mac  [513]$ composer require --dev phpunit/phpunit ^7

and I get the same result:

[InvalidArgumentException]                                                                               
  Package phpunit/phpunit at version ^7 has a PHP requirement incompatible with your PHP version (5.6.30) 

I am not sure what went wrong. Could PHP 5.6 be hiding somewhere? How can I get rid of PHP 5.6 so it will not interfere with Composer?

0 views
0 shares

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.