1/16/2024 0 Comments Phpstorm mac![]() Last, let's restart Valet for the changes to take effect: valet restart Configure PhpStorm You can do this without opening the file by simply running this: echo "xdebug.mode=debug" > xdebug.ini Move into your configuration directory ( conf.d): cd /opt/homebrew/etc/php/8.1/conf.dĪnd add the following configuration to a xdebug.ini file: xdebug.mode=debug opt/homebrew/etc/php/8.1/conf.d/php-memory-limits.ini opt/homebrew/etc/php/8.1/conf.d/ext-opcache.ini, ini files parsed: /opt/homebrew/etc/php/8.1/conf.d/error_log.ini, ini files in: /opt/homebrew/etc/php/8.1/conf.dĪdditional. Loaded Configuration File: /opt/homebrew/etc/php/8.1/php.ini This should reveal something like: Configuration File (php.ini) Path: /opt/homebrew/etc/php/8.1 With Zend OPcache v8.1.11, Copyright (c), by Zend Technologies Configure PHPįind out where your PHP configuration files are stored: php -ini With Xdebug v3.1.5, Copyright (c) 2002-2022, by Derick Rethans If you run php -version, you should now see a reference to Xdebug: PHP 8.1.11 (cli) (built: 19:44:28) (NTS) The output should end with something like this: Build process completed successfully If you have an older Mac, you can install Xdebug via: pecl install xdebug If you have the Apple M1 chip, you'll see something like arm64 at the end: /opt/homebrew/bin/php: Mach-O 64-bit executable arm64Īnd if that's the case, install Xdebug as follows: arch -arm64 pecl install xdebug Open up Terminal and confirm which CPU your Mac has: file `which php` You can get the latest version of PhpStorm by clicking the link. ![]() You'll also need PhpStorm, which is the IDE we're going to use to debug our web application. You can follow this guide on how to install Valet on your Mac. something.test) instead of 127.0.0.1 and a port to serve our web applications. Nginx is our web server and Dnsmasq allows us to use local domains (e.g. If it mentions Xdebug, you can skip the Xdebug installation step, because you already have it installed. There shouldn't be a reference to Xdebug above. With Zend OPcache v8.1.11, Copyright (c), by Zend Technologies Zend Engine v4.1.11, Copyright (c) Zend Technologies Once done, run php -version in Terminal: PHP 8.1.11 (cli) (built: 19:44:28) (NTS) Follow this link on how to get Homebrew and PHP up and running, or even the entire guide on how to get a working development environment on your Mac. We also need to install Homebrew and PHP. If you use Git, there's a good chance you do. Now, if you get an error, you may already have it installed: xcode-select: error: command line tools are already installed, use "Software Update" to install updates Let's install it with: xcode-select -install One of those tools is for working with the command line interface. Prerequisites XcodeĪpple has a program called Xcode, which includes a set of development tools. We're going to install Xdebug, configure PHP and PhpStorm, and then set up a browser helper to set necessary cookies to begin debugging our code. ![]() When you run that application, the execution will stop at each breakpoint you defined, providing you with an opportunity to inspect the state of your application, including things like which variables are defined, what value they contain, and a stack trace. Xdebug allows you to set breakpoints in your PHP application. Look at your CLI Interpreter, and go for the three dots to the right of the dropdown. Let’s jump back to PhpStorm and pop open the settings - Cmd +, (yep, that’s Command and the comma key) or from the PhpStorm menu, and select PHP on the tree on the left. Note, that’s my path though… unless your name is Marty, it’s unlikely you’ve got the same username as your macOS account.īut hey, that was easy, right? And yes, so totally obvious. It’ll look something like this: /Users/Marty/Library/Application Support/Herd/bin/php Or the PHP binary for the… uh… files? Anyway…įigure out where Herd’s PHP binary is, andīut which PHP binary… which indeed! We can run which php in your terminal and boom, we get the path to PHP. Now this is all so totally obvious… but also one of those “oh duh it’s that simple” things that someone else may sit there and not see the forest for the trees. Where is that? Herd comes with its PHP versions pre-compiled… so where do they live? No worries, we just need to update the PhpStorm configuration to Herd’s PHP binaries.īut one issue.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |