PHP configuration for debugging Laravel

All MAMP discussions around troubleshooting and anything related to MAMP. Be as detailed as possible here when posting an issue.
Post Reply
pglatz
Posts: 1
Joined: Fri Oct 06, 2023 8:49 pm

PHP configuration for debugging Laravel

Post by pglatz »

I'm running MAMP Pro 6.4.4 on a Mac (Ventura 13.60> I'm working on a Laravel app. It isn't using MAMP's web server, but is using PHP. I'm having a problem configuring it.

I pulled a git repo of the app and got artisan running, pulled down a copy of the database, and I can run the app on my local. What I need to do now is to get xdebug working. I've used MAMP for local development for years, but this is the first time I've tried just using the PHP component with another server.

I have set my default php version to 7.4.21 (since this is an older version of Laravel and is what is used on the production server). I am using phpStorm for an IDE, pointing to my local artisan server. Should this allow me to debug? One thing I noticed is if I add a call to phpinfo() to a page, it shows my php.ini file path as /Applications/MAMP/bin/php/php7.4.21/conf/php.ini which contains:
;zend_extension=“/Applications/MAMP/bin/php/php7.4.21/lib/php/extensions/no-debug-non-zts-20190902/xdebug.so”
xdebug.mode=debug
xdebug.client_host=127.0.0.1
xdebug.client_port=9003
xdebug.start_with_request=yes

As I recall, you aren’t supposed to edit the MAMP templates directly, but to edit them through MAMP. I tried that, and the file there has:
MAMP_Xdebug_MAMPzend_extension=“/Applications/MAMP/bin/php/php7.4.21/lib/php/extensions/no-debug-non-zts-20190902/xdebug.so”
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9001
xdebug.remote_autostart=1

But my app isn’t apparently recognizing either of there, since there is no xdebug entry in php.ini — it seems there should be, since it is enabled in the php.ini. If I change theMAMP template, the file /Applications/MAMP/bin/php/php7.4.21/conf/php.ini remains unchanged. Maybe I need to specify something about the ini file's location when I start the artisan server?
Post Reply