env file, in order to switch off xdebug in a production environment. i also decided to bind the new xdebug arg to the value of the app_debug variable inside the. So the context points where i copied the original docker configuration. i changed the context and added a variable under args in the first lines of docker-compose.yml:.i copied the docker configuration laravel sail uses in a more convenient place:Ĭp -r vendor/laravel/sail/runtimes/8.0.in order to include it, you have to modify the dockerfile, edit docker-compose.yml and rebuild the containers. Maybe my solution could work for you, too.Īpparently, xdebug is not installed at all with laravel sail. I had the same problem for vs code on a linux workstation. i think that it discovered many of these settings on its own: i don't remember setting all of these values: With xdebug v3.0.1, copyright (c) 2002-2020, by derick rethans With zend opcache v8.0.0, copyright (c), by zend technologies Zend engine v4.0.0-dev, copyright (c) zend technologies i built the docker containers by running sail build -no-cache.& echo "xdebug.client_host = " > /etc/php/8.0/cli/php.ini \ & echo "xdebug.start_with_request = yes" > /etc/php/8.0/cli/php.ini \ & echo "xdebug.mode = debug" > /etc/php/8.0/cli/php.ini \ I added this to the dockerfile as recommended by i was having trouble getting the conditional to return true so i hard coded true here for now: run if then \ You need to get your /etc/php/8.0/cli/php.ini file to look like this (client_host was the key): in this case i still edited the dockerfile to generate the php.ini.this lets me view/edit files easily by runningĭocker exec -it mysite.test_1 vim /etc/php/8.0/cli/php.ini.i installed vim in my docker container by adding this line to the dockerfile: run apt-get -y install vim.phpstorm version 2020.3 the version of phpstorm is important as it supports php8 and xdedbug 3.On to the fix for debugging web requests: network id name driver scopeĪd8020ad629e myprojectname_sail bridge localĮnter this in phpstorm preferences>php>cli interpreter>. Get your network name by running docker network ls. i will be reporting this to them so it may get addressed soon. with the current build of phpstorm 2020.3.1 you need to add the network name where it asks for the network mode. now i can successfully run tests and debug from within phpstorm. Update 1/18/21 to fix local environment within phpstorm so that it can find the database and the rest of the docker network. they run successfully with breakpoints if i am "listening" to sail test (which will run the tests correctly) but phpstorm can't find the mysql database when running tests and i also get this error: "xdebug: could not connect to debugging client. i have not yet figured out how to run or debug tests that rely on the database connection from inside phpstorm (right click on a test to debug). i am new to docker so there may be better ways to fix this. I have quite a bit of experience with phpstorm and xdebug 2.x. I got xdebug to work with a web request after some help from the posters above. change the ide key as configured earlier under settings and left click the extension icon > debug to start debugging.Īlso do the same inside phpstorm in the right corner. lastly start the debug session in the browser, easiest way is to use the chrome extension xdebug helper.you can do this in the top right corner of phpstorm under "add configuration." Which means your project root directory on the left should map to /var/www/html It is very important to correctly map the paths in this case: Make sure this port does not conflict with a service inside the container, in this case do not use 8000 as php already runs on this port.įile > settings > languages & frameworks > php > servers Xdebug.ini zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20180731/xdebug.soīoth the remote_port and the remote_host are very important. configure xdebug to connect to you host machine.Run chmod +x /usr/local/bin/install-php-extensions & sync & \Īfter that you need to configure xdebug, phpstorm and your browser. Personally i like to use docker-php-extension-installer to install them.Īdd these lines after line 35: add /usr/local/bin/ In order to run xdebug you need to install the php extension. The underlying dockerfile can be found here.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |