1. MAMP

The professor recommends MAMP, and I think MAMP is easy and friendly for a loser like me. MAMP is available for free (gray icon) and premium PRO (blue icon). If you only want one-click startup, check out the option and just install the free version. Download: www.mamp.info/en/ Some computers with MySQL Server installed will not be able to start MySQL Server in MAMP. In general, removing MySQL can solve the problem. Remember that removing MySQL is not a matter of pulling it in the trash. I ended up having to reinstall the system as a result of my rough handling. Normal startup as shown below:

2. PHPStorm

Plan 1: PHPStorm is free for students. School email address is required for application address: www.jetbrains.com/student/, if you are overseas students certification should be pretty fast, also do not need to upload the student id card.

Plan two: not students, their own money

3. Xdebug

Downloading Xdebug is theoretically convenient for Mac users. Installation guide on the official website: xdebug.org/docs/instal…

First of all to install Homebrew, using the command: / usr/bin/ruby – e “$(curl – fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

Homebrew/PHP /php71-xdebug has been deprecated since the beginning of 2018, so please use PECL install xdebug

Pecl: Command not found: pecl: Command not found

  1. To reload PHP via Homebrew, use the following command:

Brew install [email protected] Pear and PECl commands can be found by finding -l “$(brew –prefix [email protected])” -name pecl-o-name pear. 2. Pecl is still unavailable. Try reconnecting to pecL. Brew unlink [email protected] && Brew link [email protected] –dry-run && Brew Link — Overwrite — Force [email protected] (The above solution comes from Stackoverflow.com/questions/3…

4. Configure php.ini and the Xdebug extension

If you search for php.ini now, you might get an infinite number of versions of php.ini. You only need to modify the corresponding version of the file to take effect. There are two ways to view the Version, click MAMP, MAMP->Preference->PHP->Standard Version. Or use phpInfo () to view it. Add in php.ini

[xdebug] zend_extension = "/ Applications/MAMP/bin/PHP/php7.2.7 / lib/PHP/extensions/no - debug - non - ZTS - 20170718 / xdebug. So" xdebug.remote_enable=1 xdebug.remote_autostart=on xdebug.remote_log="/var/log/xdebug.log" xdebug.remote_port=9000 xdebug.remote_handler="dbgp" xdebug.idekey="PhpStorm"Copy the code

zend_extensionThe following address comes from the xdebug.so address written in php.ini, for example:

— Since you are modifying php.ini, why not turn On display_errors and error_reporting and search for display_errors and change Off to On. Search for error_reporting and change it to e_all. display_error has higher permissions than error_reporting. If error_reporting is Off, error_reporting = E_ALL should not take effect.

Save php.ini, restart PHP, and usephpinfo()Check whether Xdebug is enabled, as shown in the following figure:Note that the port here should be 9000:

5. Configuration PHPStorm

PHPStorm-> Preference -> Languages & Frameworks -> PHP:Click after CLI Interpreter… : Click + to add the Interpreter path, and Debugger: Xdebug appears

B) Open PHPStorm-> Preference -> Languages & Frameworks -> PHP -> Debug -> DBGp Proxy

IDE key: PHPSTORM Host: localhost Port: 9000

C) Open PHPStorm-> Preference -> Languages & Frameworks -> PHP -> Server and click + add localhost: Name: localhost Host: localhost Port: 80 Debugger: Xdebug

D) Open Run -> Edit Configuration and click + select PHP Web Page Server: localhost Start URL: Enter the Page you want to visit, for example, test.php

6. The plugin

Xdebug Helper or JetBrains IDE Support is available for Both Chrome and Firefox. Download Xdebug Helper or JetBrains IDE Support from the Chrome App Store. Double-click the option and set the IDE Key to PHPSTORM

Click the Debug:

Go back to PHPStorm and click the phone button in the upper right corner to turn on Listening:

Then you can happily add breakpoints and click the Ladybug button to start debugging.

And you’re done.