In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
How to use the phpstorm debug tool yasd, aiming at this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.
Usually, in development, there will always be times when debug is needed. Manual breakpoints such as var_dump and die are always time-consuming and not elegant. At this time, someone may choose to install the xdebug extension and configure xdebug in the phpstorm to debug.
But when you need to use the swoole framework, and need to debug the code in the swoole framework, xdebug can not be used on swoole, there is a conflict with swoole.
Then I found an easy-to-use debug debugging tool that is compatible with fpm framework and swoole framework, yasd.
Installation
1. Install the boots library on Mac
Brew install boost
two。 Download yasd source code from Github
Git clone https://github.com/swoole/yasd.git
3. Compile and install yasd
Cd yasdphpize-- clean & &\ phpize & &\. / configure & &\ make clean & &\ make &\ make install
4. Modify php.ini
Zend_extension= "yasd.so"; command line debugging; yasd.debug_mode=cmd; remote debugging yasd.debug_mode=remote; local development address yasd.remote_host=127.0.0.1; local development listening port yasd.remote_port=9000
View extended information
➜yasd php-- ri yasdyasdYasd = > enabledAuthor = > codinghuang Version = > 0.3.9-alphaBuilt = > Jan 15 2022 14:09:47Directive = > Local Value = > Master Valueyasd.breakpoints_file = > no value = > no valueyasd.debug_mode = > remote = > remoteyasd.remote_host = > 127.0.0.1 = > 127.0.0.1yasd.remote_port = > 9000 = > 9000yasd.depth = > 1 = > 1yasd.log_level = >-1 = >-1yasd.max_executed_opline_num = > 0 = > 0yasd.init_file = > no value = > no valueyasd .open _ extended_info = > 0 = > 0xdebug.coverage_enable = > 1 = > 1xdebug.profiler_enable = > 1 = > 1xdebug.remote_autostart = > 1 = > 1xdebug.remote_connect_back = > 0 = > 0xdebug.remote_mode = > req = > reqxdebug.idekey = > hantaohuang = > hantaohuang
5. Debug script
To debug a script using yasd, you must add the php parameter of-e, such as this
# debugging ordinary php script php-e test.php# debugging laravel's commandphp-e artisan test# debugging hyperf framework php-e bin/hyperf start
Configure phpstorm
1. Configure phpstorm to listen on port 9000
two。 Click the phone icon in the upper right corner of phpstorm to start monitoring
3. Test debug debugging
Write a random test command in Laravel
Php-e artisan test
It has been a success since we got here.
Debug Hyperf framework
It said above to debug in fpm, and then let's talk about how to debug in Hyperf framework.
A few points to pay attention to
1. In Hyperf, you need to set the scan_cacheable parameter in config.php to true, which is whether to scan the proxy class. If set to true, each startup will directly scan the cache proxy class instead of rescanning the generation proxy class.
Once set to true, it should be noted that each modification of the code requires manual generation of the proxy class, composer dump-autoload-o, and then at startup.
Or modify the code directly in the proxy class, and then copy the code in the proxy class to the real class when the debug is over.
The proxy class generation path is in runtime/container/proxy
2. If Swoole Server is used in the Hyperf framework, you need to set worker_num to 1 or the breakpoint may not take effect. This parameter is in server.php.
The rest of the debugging is no different from what was mentioned above.
The answer to the question about how to use the phpstorm debug tool yasd is shared here. I hope the above content can be of some help to everyone. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 269
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.