Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Mattiman's avatar

Composer using wrong php version

On my mac I use AMMPS, with PHP version 5.5.12. However, when I try to install Laravel I get the error:

Created project in laravel51
> php -r "copy('.env.example', '.env');"
Loading composer repositories with package information
Installing dependencies (including require-dev)
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 (5.4.28) does not satisfy that requirement.
  Problem 2
    - laravel/framework v5.1.7 requires php >=5.5.9 -> your PHP version (5.4.28) does not satisfy that requirement.
    - laravel/framework v5.1.6 requires php >=5.5.9 -> your PHP version (5.4.28) does not satisfy that requirement.
    - laravel/framework v5.1.5 requires php >=5.5.9 -> your PHP version (5.4.28) does not satisfy that requirement.
    - laravel/framework v5.1.4 requires php >=5.5.9 -> your PHP version (5.4.28) does not satisfy that requirement.
    - laravel/framework v5.1.3 requires php >=5.5.9 -> your PHP version (5.4.28) does not satisfy that requirement.
    - laravel/framework v5.1.2 requires php >=5.5.9 -> your PHP version (5.4.28) does not satisfy that requirement.
    - laravel/framework v5.1.1 requires php >=5.5.9 -> your PHP version (5.4.28) does not satisfy that requirement.
    - laravel/framework v5.1.0 requires php >=5.5.9 -> your PHP version (5.4.28) does not satisfy that requirement.
    - Installation request for laravel/framework 5.1.* -> satisfiable by laravel/framework[v5.1.0, v5.1.1, v5.1.2, v5.1.3, v5.1.4, v5.1.5, v5.1.6, v5.1.7].

So it seems that composer thinks I'm using a different PHP version. So I can't install Laravel and its dependencies. How can I solve this?

0 likes
12 replies
pmall's avatar

but your PHP version (5.4.28) does not satisfy that requirement

There is obviously something wrong with your php setup. What is your os ? Update the php version of the os

Mattiman's avatar

Well I'm using AMPPS as a server. It is using PHP version 5.5.12, I checked with running phpinfo(). So the PHP version on my Mac shouldn't have to matter. And I also would not know how to update that.

pmall's avatar

So the PHP version on my Mac shouldn't have to matter.

Of course it does matter because composer use the version installed on the os.

ian_h's avatar

@Mattiman What do you get when you run 'php -v' from the cmdline?

Cheers..

Ian

Mattiman's avatar

Then I get PHP 5.4.28 (cli) (built: May 5 2014 15:10:56)

But that's not the PHP that is used by the webserver. So it seems the command line and composer think I'm using an older version. But I'm not :(

ian_h's avatar

@Mattiman The cmdline and webserver are obviously configured to use different versions.

You could try changing / adding your AMMPS PHP path to your PATH env.

AMMPS has obviously set up it's own path vars as a "self-contained setup" so to speak, but running composer on the cmdline will use your actual system version unless you change your PATH for PHP.

Cheers..

Ian

Mattiman's avatar

Ian, thanks for the help.

How do I change/add my AMPPS path to the PATH env? I have no idea what PATh env is.

andy's avatar

I agree with @ian_h your path to php in AMMPS and the version of php installed with OSX are not pointing to the same php installs.

AMMPS probably installed it's own version somewhere.

I don't use BASH as my command line interface anymore and have moved on to ZSH and oh-my-zsch since bash was getting attacked during the heart bleed exploit days.

my .zsh profile setting looks like (below) and you will need to setup your bash or zsh profile to do something similar.

export PATH="$(brew --prefix homebrew/php/php55)/bin:$PATH"

My example above uses homebrew so I'm sure AMPPS will have it's own area to point to.

However! I would recommend to moving to:

  1. OSX + homebrew (which uses OSX's apache, homebrew's updated php, homebrew's installed mysql and all kinds of other homebrew goodies like imagemagic and such)
  2. move to vagrant and homestead (I haven't used homestead but there are lots of laracast videos and lots of tutorials on how to set it up)

Reasoning:

  1. Personally, I've hated every install that MAMP and friends installed. I couldn't figure out how to make them work properly while I was able to configure, make and install from the command line which should be way more difficult.
  2. OSX is already a server. So why put server software on top of a server that already exists???
  3. The Vagrant method actually is much more versatile and will allow you to fire up almost any type of hosting environment that you can dream of. The issues I have with this method is that once again, you are firing up extra memory usage to run a server but my personal choice means you are developing on OSX and will come into issues like Capitalization and such when you put your code into production on say an Ubuntu machine.

Even though I love my choice of OSX + homebrew it does require you maintain your own dependencies and you won't be able to just grab a copy of homestead that has been vetted by the community. You do end up fixing lots of things on your own.

Up and running time: Vagrant wins local system resource usage: Probably OSX + home brew wins ( although I haven't done any real testing on this) long term usage: TIE. You will probably end up down the road building your own personal vagrant based box and will learn how to script it. OSX and homebrew involves maintaining your own setup and googling issues when OSX updates wipe out something. Popularity: Vagrant + homestead wins because people love Taylor ;-) well it sure does seem that the laravel community eats up this option.

final suggestion: send AMPPS to /null ;-)

1 like
bashy's avatar

PHP CLI binary is different to web one.?

skliche's avatar

@Mattiman I see the following options:

  1. Update your Mac OS X installation. Mac OS X 10.10.4 seems to provide PHP 5.5.23.
  2. Find the PHP executable used by AMPPS and run composer through that. I have never used AMPPS so I have no idea where it hides its stuff. You can find all PHP executables on your installation with this command: find / -name php -type f -perm +111 2>nul
  3. Use a package manager like homebrew to install an updated version of PHP. See recommendation above by andy.
  4. Use Laravel Homestead. It's easy to use but has it's own quirks.
Mattiman's avatar

@Andy: thanks for your elaborate reply. It is indeed a difference between Ampps and Command line pointing to different php versions.

I’m have very little knowledge of bash/zsh etc. I did find out that I have a bash_profile file in which at the top is:

export PATH=/usr/local/git/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
export PATH=/Applications/AMPPS/php-5.4/bin:$PATH
export PATH=~/.composer/vendor/bin:$PATH

So I changed that to php-5.5 and now I can install Laravel! I did have to add PHP extensions for SSL and tokenizer to AMPPS, but that was just checking a few checkboxes in AMPPS.

About your suggestions

  • homebrew: I might have installed that in the past. However, as with anything commandline, if I don’t use it regularly I forget it.
  • homestead: I have that running as well, next to my AMPPS install. It’s kind of OK. But Homestead has given me much more trouble with all kinds of installation or upgrade problems than AMMPS, unfortunately. And I find AMPPS useful for running many of my (smallish) projects, mostly wordpress sites, since I have about 50 or 60 websites running. Homestead is more suited if you are working on one big project in which that single project needs to have a certain config. With AMMPS (or similar MAMP etc), it’s just a matter of clicking a few buttons and I’m done adding a new website. No need to run all kinds of command in the terminal, and often dealing with and figuring out obscure bugs for which I have to search trough dozens of stackoverflow questions, etc.

The issue is that I have a background of design and front end development, having gotten into PHP/mysql development gradually in the last 6-8 years. Very little Unix/command line experience. And there’s is just -no- good documentation on that. Only obscure forum threads and stackoverflow discussions to wade through if I have a problem. At least with PHP every function has it’s own manual page.

@Skliche:

  1. updating OS X is at the moment not possible yet. I want to, but my adobe install only runs on Mavericks. 2/3/4 Updating OSX php shouldn’t be necessary, since the server in AMPPS runs it’s own php. Homestead: see my answer above. It’s OK, and I see its potential, but it’s still too buggy for a non-hardcore developer
mdisseny's avatar

Maybe a little late... but it is possible to update the php version without upgrading your OSX from Mavericks to Yosemite or El Capitan.

1) Download and Install PHP5.5

curl -s http://php-osx.liip.ch/install.sh | bash -s 5.5

PHP version is from this PHP Packaged site (http://php-osx.liip.ch/) which is being maintained for OSX and is known as a reliable source.

2) Adjust your PATH

php-osx doesn't overwrite the php binaries installed by Apple, but installs everyting in /usr/local/php5. The new php binary is therefore in /usr/local/php5/bin/php. To Edit Your PATH Environment Variables On Mac OS X:

touch ~/.bash_profile; open ~/.bash_profile

A .txt file opens in textedit, add the following line to the end of the file and save it:

export PATH=/usr/local/php5/bin:$PATH

3) Check PHP version

Restart your terminal and type: php -v to check your current PHP version.

Hope this helps. Full guide here: http://coolestguidesontheplanet.com/upgrade-to-php-5-4-or-5-5-mac-osx-10-8-mountain-lion/ More info http://marcjulia.com/php/actualitzar-versio-5-4-5-5-osx-mavericks/

1 like

Please or to participate in this conversation.