Home > Article > Backend Development > How do I Override the System PHP Path to Use the MAMP PHP Path on macOS?
Overriding PHP Path to Use MAMP Path
If you have inadvertently disrupted your PHP configuration on macOS while attempting to enable the SOAP module, it may become necessary to utilize the MAMP PHP path instead. However, typing the complete path Applications/MAMP/bin/php5.3/bin/php for every command line operation can be cumbersome.
To streamline this process, you can override the system PHP path with the MAMP path. Here's how:
1. Create a .bash_profile File
Navigate to your home directory (/Users/your_username) and create a file named .bash_profile using a text editor.
2. Add MAMP PHP Path
Edit the .bash_profile file and add the following lines:
<code class="bash">export MAMP_PHP=/Applications/MAMP/bin/php/php5.3.6/bin export PATH="$MAMP_PHP:$PATH"</code>
3. Save and Restart Terminal
Save the .bash_profile file and restart your Terminal window.
4. Verification
To confirm that the MAMP PHP path has been overridden, run the following commands:
By following these steps, you can easily override the system PHP path and use the MAMP PHP path instead. This eliminates the need to manually type the complete path for command line operations, making development tasks more convenient.
The above is the detailed content of How do I Override the System PHP Path to Use the MAMP PHP Path on macOS?. For more information, please follow other related articles on the PHP Chinese website!