PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, December 28, 2021

[FIXED] Changing php version in mamp

 December 28, 2021     macos, mamp, php     No comments   

Issue

I am using the latest version of MAMP. In my MAMP settings, I can find the latest version of PHP as 7.1.1, but when I run php -v i get this:

PHP 5.5.14 (cli) (built: Sep  9 2014 19:09:25) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies

I am not able to change it. There is no folder like php5.5.14 inside MAMP/bin/php/


Solution

That's because it's referring to the pre-installed PHP of your OSX. You need to change that to point to your MAMP PHP. To do so you need to edit the .bash_profile with a text editor and add the MAMP version of PHP to the PATH variable.

Follow these steps (source):

  1. Within the Terminal, run
vim ~/.bash_profile
  1. Type i and then paste the following at the top of the file:
export PATH=/Applications/MAMP/bin/php/php7.1.1/bin:$PATH
  1. Hit ESC, Type :wq, and hit Enter

  2. In Terminal, run:

 source ~/.bash_profile
  1. In Terminal, type in which php again and look for the updated string. If everything was successful, It should output the new path to MAMP PHP install.

In case it doesn't output the correct path, try closing the terminal window (exit fully) and open again, it should apply the changes.



Answered By - hatef
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing