![]() ![]() This only applies to MAMP Pro as the non-Pro version doesn't generates any php.ini and if you want to change something you need to edit the original file yourself. Of course the example is for PHP 7.3.21 but you will need to repeat this for the folder of each PHP version you will be using on the Command-line. The conf folder should ended up looking like this: Then we need to create a symlink called php.ini for /Library/Application Support/appsolute/MAMP PRO/conf/php.ini (which is the auto generated one by MAMP) by doing: ln -sf /Library/Application\ Support/appsolute/MAMP\ PRO/conf/php.ini php.ini We already configured the Terminal to use MAMP's PHP binaries but we also need to configure it to use the generated php.ini by going to /Applications/MAMP/bin/php/php7.3.21/conf (where the not auto generate php.ini file is located) and delete it (after a back up). The final generated php.ini file is located at /Library/Application Support/appsolute/MAMP PRO/conf/php.ini. Here's something interesting about MAMP Pro: it generates, each time it starts, the final php.ini file it will be using during the execution as its content depends on the settings configured on the software’s UI.įor example, if you enable/disable Xdebug on MAMP by ticking/unticking the checkbox on the app, MAMP will regenerate the php.ini file with your configuration (this is basically how MAMP applies any setting change that you perform from the UI). Configuring the Command-line to use MAMP's php.ini You can check if everything was applied as expected by executing php -ini and seeing the paths are pointing to MAMP. I had a lot of trial and error, but finally managed to send mails with Mamp on my Windows 10 machine using these settings: Edit you php. Remember that everytime you change your Profile you need to "reload" it by doing source ~/.bash_profile (or whatever file you are using). Mines it's ~/.zshrc because I use Oh My Zsh. If you are using the default Terminal coming with macOS chances are the Profile will either be ~/.bash_profile or ~/.bashrc. Your Command-line's Profile file depends on your shell. #export PATH=/Applications/MAMP/bin/php/php7.4.9/bin:$PATHĪs you can see I'm adding a different line per PHP version I want to potentially have available on the Command-line (PHP 7.1.33, PHP 7.2.33, etcetera) but having them all but one (PHP 7.3.21) commented with the # at the beginning.Įvery time you switch the PHP version in MAMP you should come back to the Profile and leave uncomment the same version so the Terminal and MAMP match. #export PATH=/Applications/MAMP/bin/php/php7.2.33/bin:$PATHĮxport PATH=/Applications/MAMP/bin/php/php7.3.21/bin:$PATH You need to edit your Terminal's Profile in order to add the following to the end: #export PATH=/Applications/MAMP/bin/php/php7.1.33/bin:$PATH Configuring the Command-line to use MAMP's PHP This next one is how I personally do it because it's easy to implement and it also covers something most of other guides won't which is configure the Terminal to also use the same php.ini MAMP uses. Out there you can find enough guides that helps you archive this because, frankly, there are plenty of methods to get this done. The idea behind changing the Command-line to start using the PHP coming with MAMP and its configuration is to be able to switch rapidly between PHP versions and to have the configuration for PHP in only one place. Add some breakpoints, start the debugger and it will stop when that code is run.By default, after installation, MAMP will make its PHP binaries "available on the browser" while the Terminal will keep on using the system's PHP with its own configuration. Make sure PHP Debug is set to "Listen for Xdebug" and you should be good to go. The default configuration should do to begin with, for more information on how to configure PHP Debug check out the extension docs.Īutomatically generate a config file for PHP Debug Choose PHP as you environment and VSCode will generate a launch.json file. Open the dropdown where it says ”No Configuration” and click ”Add configuration ”. Open the debug panel in the VSCode side bar. If you are using an older version of VSCode you may need to reload the editor after installing the extension. Search for PHP Debug in the VSCode extensions and install it. The PHP version should be there already depending on what you MAMP settings are.Īfter saving and exiting MAMP should restart.ģ. Find the Xdebug section (likely on the bottom of the file) and make sure it looks like this: When still inside MAMP Pro, open File > Edit template > PHP (php.ini) and select the version of PHP you are running. If you are using regular MAMP and not the pro version this guide is roughly equivalent to step one and two. Make sure that Xdebug is enabled in the PHP section of MAMP.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |