Skip to content

PHP Articles

php | frameworks | cms | and all web things.

Menu
  • Home
  • Laravel
  • WordPress
  • Server
  • Database
  • Google
Menu
mampf

How To Change Pre-Installed PHP Version To MAMP In Mac/osx

Posted on January 6, 2018February 4, 2021 by admin

If you are using Mac OSX for the first time and switched from the windows environment and want to develop some cool web-based application then you need to install MAMP which is absolutely free. After installing MAMP on your local environment you need to add the MAMP version of PHP to the PATH variable.

Instructions to Change PHP Installation:

First, Let’s find out what version of PHP we’re running (To find out if it’s the default version). To do that, within the terminal, run this command:

which php

This should output the path to the default PHP install which comes pre-installed by Mac OSX, by default it has to be (Assuming you’ve not changed it before):

/usr/bin/php

Now, we just need to swap this over to the PHP that is installed with MAMP, which is located at

/Applications/MAMP/bin/php/php7.1.6/bin

To do this, we need to edit the .bash_profile and add the MAMP version of PHP to the PATH variable.

Within the Terminal, run

vim ~/.bash_profile

Type i and then paste the following at the top of the file:

export PATH=/Applications/MAMP/bin/php/php7.1.6/bin:$PATH

Hit esc, Type :wq, and hit enter.

In Terminal, run

source ~/.bash_profile

Now type in which php again and look for the updated string. If everything was successful, It should output the new path to the MAMP PHP install.

Happy Coding 😉

Share this:

  • Twitter
  • Facebook

Top Posts

  • Laravel Swagger Authenticate Users Via Bearer Token

Recent Posts

  • Custom Gutenberg Block In WordPress
  • Laravel Swagger Authenticate Users Via Bearer Token
  • How To Use Darkaonline/l5-Swagger In Laravel
  • How To Fix You Already Have An Adsense Account
  • Laravel Passport Create Api For Your Application
  • Laravel Api Integration & Configuration

Archives

  • February 2021
  • July 2020
  • March 2020
  • February 2020
  • May 2019
  • January 2019
  • April 2018
  • March 2018
  • January 2018
  • December 2017

Categories

  • Ajax
  • Database
  • Google
  • Laravel
  • Server
  • WordPress
© 2022 PHP Articles | Powered by Minimalist Blog WordPress Theme