Skip to content

How to configure the PHP command line on Mac? #864

Discussion options

You must be logged in to vote

Here's the summary for a solution with MAMP.

  1. Check which PHP versions are available in MAMP:
    ls -l /Applications/MAMP/bin/php
  2. Check which PHP version is currently selected in MAMP:
    preferences are accessible in the menu → MAMP → Preferences
  3. Create an alias for the desired PHP version, for example:
    alias php='/Applications/MAMP/bin/php/php7.4.33/bin/php'
  4. Save the alias in your configuration file, this step is optional:
    nano ~/.profile
  5. Now you should have the same PHP version in the command line.

Replies: 4 comments 14 replies

Comment options

You must be logged in to vote
13 replies
@pawell0
Comment options

@schulle4u
Comment options

@pawell0
Comment options

@annaesvensson
Comment options

@pawell0
Comment options

Comment options

You must be logged in to vote
1 reply
@schulle4u
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by pawell0
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants