Closed xiangjihan closed 1 year ago
1、Hyperf 启动时会创建子进程进行代码扫描,尝试放在 $application->run()
的前一行?
2、换一个终端试试?
1、Hyperf 启动时会创建子进程进行代码扫描,尝试放在
$application->run()
的前一行? 2、换一个终端试试?
大佬一出手,就知有木有,确实是引入SDB的位置的问题,放在$application->run()之前一行就没有问题了,非常感谢!
require BASE_PATH . '/vendor/autoload.php';
//\Swow\Debug\Debugger\Debugger::runOnTTY('swow');
// Self-called anonymous function that creates its own scope and keep the global namespace clean.
(function () {
Hyperf\Di\ClassLoader::init(handler: new Hyperf\Di\ScanHandler\ProcScanHandler());
/** @var Psr\Container\ContainerInterface $container */
$container = require BASE_PATH . '/config/container.php';
/** @var Symfony\Component\Console\Application $application */
$application = $container->get(Hyperf\Contract\ApplicationInterface::class);
\Swow\Debug\Debugger\Debugger::runOnTTY('swow');
$application->run();
})();
另外文档中的runOnTTY的命名空间的路径少了一个Debugger。
\Swow\Debug\Debugger::runOnTTY('swow');
实际用的时候是:
\Swow\Debug\Debugger\Debugger::runOnTTY('swow');
Describe the bug / 问题描述 在windows 10 下使用hyperf3.0(for swow),使用SDB时,提示:Fatal error: Uncaught Swow\SocketException: Socket open with type STDOUT failed, reason: Bad file descriptor in F:\native\zend\imfine\vendor\swow\swow\lib\swow-library\src\Debug\Debugger\Debugger.php:136
To Reproduce / 如何复现 1、使用命令创建项目
composer create-project hyperf/swow-skeleton
2、在bin/hyperf.php 的中添加runOnTTY3、使用php -e bin/hyperf.php start 命令启动 4、在提示符后输入r,回车就会报错。
Expected behavior / 正确的行为 在输入r回车之后,项目应该能够启动,然后进入调试模式。
Outputs / 程序输出
Runtime Environment / 运行环境 OS:Windows 10 专业工作站版 22H2 19045.3208
php-8.2.8-nts-Win32-vs16-x64.zip
PHP 8.2.8 (cli) (built: Jul 4 2023 15:53:30) (NTS Visual C++ 2019 x64) Copyright (c) The PHP Group Zend Engine v4.2.8, Copyright (c) Zend Technologies
Swow
Status => enabled Author => Swow Team Link => https://github.com/swow/swow Contact => Twosee twosee@php.net Version => 1.3.1-b0661b59 ( NTS ) Built => Jun 14 2023 19:55:36 Context => boost-context Scheduler => libuv-event SSL => OpenSSL 3.0.8 7 Feb 2023 (built with OpenSSL 3.0.7 1 Nov 2022) cURL => libcurl/7.85.0 OpenSSL/3.0.8 zlib/1.2.12 WinIDN libssh2/1.10.0 nghttp2/1.49.0 PostgreSQL => libpq/11.4 (built with 11.4)
Additional context / 补充说明 在AlmaLinux 9.2中一切正常,且php和swow版本与windows环境下使用一致。 以下为项目依赖项的信息: composer/pcre 3.1.0 PCRE wrapping library that offers type-safe preg_* replacements. composer/semver 3.3.2 Semver library that offers utilities, version constraint parsing and validation. composer/xdebug-handler 3.0.3 Restarts a process without Xdebug. doctrine/annotations 2.0.1 Docblock Annotations Parser doctrine/inflector 2.0.8 PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words. doctrine/instantiator 1.5.0 A small, lightweight utility to instantiate objects in PHP without invoking their constructors doctrine/lexer 3.0.0 PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers. fig/http-message-util 1.1.5 Utility classes and constants for use with PSR-7 (psr/http-message) friendsofphp/php-cs-fixer v3.22.0 A tool to automatically fix PHP code style graham-campbell/result-type v1.1.1 An Implementation Of The Result Type guzzlehttp/guzzle 7.7.0 Guzzle is a PHP HTTP client library guzzlehttp/promises 2.0.0 Guzzle promises library guzzlehttp/psr7 2.5.0 PSR-7 message implementation that also provides common utility methods hamcrest/hamcrest-php v2.0.1 This is the PHP port of Hamcrest Matchers hyperf-extension/auth 3.0.17.0 The Hyperf Auth package. hyperf-extension/hashing v3.0.0 The Hyperf Hashing package. hyperf-extension/jwt 3.0.17.0 The Hyperf JWT package. hyperf/cache v3.0.26 A cache component for hyperf. hyperf/code-parser v3.0.18 A code parser component for Hyperf. hyperf/codec v3.0.1 A codec component for Hyperf. hyperf/collection v3.0.29 Hyperf Collection package which come from illuminate/collections hyperf/command v3.0.27 Command for hyperf hyperf/conditionable v3.0.0 Hyperf Macroable package which come from illuminate/conditionable hyperf/config v3.0.20 An independent component that provides configuration container. hyperf/constants v3.0.18 A constants component for hyperf. hyperf/context v3.0.18 A coroutine/application context library. hyperf/contract v3.0.10 The contracts of Hyperf. hyperf/coordinator v3.0.22 Hyperf Coordinator hyperf/coroutine v3.0.16 Hyperf Coroutine hyperf/database v3.0.27 A flexible database library. hyperf/db-connection v3.0.24 A hyperf db connection handler for hyperf/database. hyperf/devtool v3.0.18 A Devtool for Hyperf. hyperf/di v3.0.24 A DI for Hyperf. hyperf/dispatcher v3.0.24 A HTTP Server for Hyperf. hyperf/engine-contract v1.9.0 Contract for Coroutine Engine hyperf/engine-swow v2.10.0 Coroutine engine provided by swow. hyperf/event v3.0.0 an event manager that implements PSR-14. hyperf/exception-handler v3.0.24 Exception handler for hyperf hyperf/framework v3.0.23 A coroutine framework that focuses on hyperspeed and flexible, specifically use for build microservices and middlewares. hyperf/guzzle v3.0.24 Swoole coroutine handler for guzzle hyperf/http-message v3.0.18 microservice framework base on swoole hyperf/http-server v3.0.24 A HTTP Server for Hyperf. hyperf/logger v3.0.20 A logger component for hyperf. hyperf/macroable v3.0.0 Hyperf Macroable package which come from illuminate/macroable hyperf/model-listener v3.0.18 A model listener for Hyperf. hyperf/phar v3.0.18 A component that supports pack Hyperf project as a Phar stand-alone package. hyperf/pipeline v3.0.16 Hyperf Macroable package which come from illuminate/pipeline hyperf/pool v3.0.18 An independent universal connection pool component. hyperf/process v3.0.22 A process component for hyperf. hyperf/serializer v3.0.0 A serializer component for Hyperf. hyperf/server v3.0.24 A base server library for Hyperf. hyperf/stringable v3.0.27 Hyperf Stringable package which come from illuminate/support hyperf/support v3.0.24 A support component for Hyperf. hyperf/tappable v3.0.0 Hyperf Macroable package which come from illuminate/tappable hyperf/task v3.0.19 A task library for Hyperf. hyperf/testing v3.0.23 Testing for hyperf hyperf/utils v3.0.18 A tools package that could help developer solved the problem quickly. hyperf/view v3.0.18 A view library for Hyperf. hyperf/view-engine v3.0.21 laminas/laminas-mime 2.11.0 Create and parse MIME messages and parts laminas/laminas-stdlib 3.17.0 SPL extensions, array utilities, error handlers, and more lcobucci/clock 2.3.0 Yet another clock abstraction lcobucci/jwt 4.1.5 A simple library to work with JSON Web Token and JSON Web Signature mockery/mockery 1.6.3 Mockery is a simple yet flexible PHP mock object framework monolog/monolog 3.4.0 Sends your logs to files, sockets, inboxes, databases and various web services myclabs/deep-copy 1.11.1 Create deep copies (clones) of your objects nesbot/carbon 2.68.1 An API extension for DateTime that supports 281 different languages. nikic/fast-route v1.3.0 Fast request router for PHP nikic/php-parser v4.16.0 A PHP parser written in PHP phar-io/manifest 2.0.3 Component for reading phar.io manifest information from a PHP Archive (PHAR) phar-io/version 3.2.1 Library for handling version information and constraints php-di/phpdoc-reader 2.2.1 PhpDocReader parses @var and @param values in PHP docblocks (supports namespaced class names with the same resolution rules as PHP) phpoption/phpoption 1.9.1 Option Type for PHP phpstan/phpstan 1.10.25 PHPStan - PHP Static Analysis Tool phpunit/php-code-coverage 9.2.26 Library that provides collection, processing, and rendering functionality for PHP code coverage information. phpunit/php-file-iterator 3.0.6 FilterIterator implementation that filters files based on a list of suffixes. phpunit/php-invoker 3.1.1 Invoke callables with a timeout phpunit/php-text-template 2.0.4 Simple template engine. phpunit/php-timer 5.0.3 Utility class for timing phpunit/phpunit 9.6.10 The PHP Unit Testing framework. psr/cache 3.0.0 Common interface for caching libraries psr/clock 1.0.0 Common interface for reading the clock. psr/container 2.0.2 Common Container Interface (PHP FIG PSR-11) psr/event-dispatcher 1.0.0 Standard interfaces for event handling. psr/http-client 1.0.2 Common interface for HTTP clients psr/http-factory 1.0.2 Common interfaces for PSR-7 HTTP message factories psr/http-message 1.1 Common interface for HTTP messages psr/http-server-handler 1.0.2 Common interface for HTTP server-side request handler psr/http-server-middleware 1.0.2 Common interface for HTTP server-side middleware psr/log 3.0.0 Common interface for logging libraries psr/simple-cache 3.0.0 Common interfaces for simple caching ralouphie/getallheaders 3.0.3 A polyfill for getallheaders. sebastian/cli-parser 1.0.1 Library for parsing CLI options sebastian/code-unit 1.0.8 Collection of value objects that represent the PHP code units sebastian/code-unit-reverse-lookup 2.0.3 Looks up which function or method a line of code belongs to sebastian/comparator 4.0.8 Provides the functionality to compare PHP values for equality sebastian/complexity 2.0.2 Library for calculating the complexity of PHP code units sebastian/diff 4.0.5 Diff implementation sebastian/environment 5.1.5 Provides functionality to handle HHVM/PHP environments sebastian/exporter 4.0.5 Provides the functionality to export PHP variables for visualization sebastian/global-state 5.0.5 Snapshotting of global state sebastian/lines-of-code 1.0.3 Library for counting the lines of code in PHP source code sebastian/object-enumerator 4.0.4 Traverses array structures and object graphs to enumerate all referenced objects sebastian/object-reflector 2.0.4 Allows reflection of object attributes, including inherited and non-public ones sebastian/recursion-context 4.0.5 Provides functionality to recursively process PHP variables sebastian/resource-operations 3.0.3 Provides a list of PHP built-in functions that operate on resources sebastian/type 3.2.1 Collection of value objects that represent the types of the PHP type system sebastian/version 3.0.2 Library that helps with managing the version number of Git-hosted PHP projects stella-maris/clock 0.1.7 A pre-release of the proposed PSR-20 Clock-Interface swow/swow v1.3.1 Coroutine-based multi-platform support engine with a focus on concurrent I/O symfony/console v6.3.0 Eases the creation of beautiful and testable command line interfaces symfony/deprecation-contracts v3.3.0 A generic function and convention to trigger deprecation notices symfony/event-dispatcher v6.3.0 Provides tools that allow your application components to communicate with each other by dispatching events and listening to them symfony/event-dispatcher-contracts v3.3.0 Generic abstractions related to dispatching event symfony/filesystem v6.3.1 Provides basic utilities for the filesystem symfony/finder v6.3.0 Finds files and directories via an intuitive fluent interface symfony/http-foundation v6.3.1 Defines an object-oriented layer for the HTTP specification symfony/options-resolver v6.3.0 Provides an improved replacement for the arrayreplace PHP function symfony/polyfill-ctype v1.27.0 Symfony polyfill for ctype functions symfony/polyfill-intl-grapheme v1.27.0 Symfony polyfill for intl's grapheme* functions symfony/polyfill-intl-normalizer v1.27.0 Symfony polyfill for intl's Normalizer class and related functions symfony/polyfill-mbstring v1.27.0 Symfony polyfill for the Mbstring extension symfony/polyfill-php80 v1.27.0 Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions symfony/polyfill-php81 v1.27.0 Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions symfony/polyfill-php83 v1.27.0 Symfony polyfill backporting some PHP 8.3+ features to lower PHP versions symfony/process v6.3.0 Executes commands in sub-processes symfony/property-access v6.3.0 Provides functions to read and write from/to an object or array using a simple string notation symfony/property-info v6.3.0 Extracts information about PHP class' properties using metadata of popular sources symfony/serializer v6.3.1 Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON. symfony/service-contracts v3.3.0 Generic abstractions related to writing services symfony/stopwatch v6.3.0 Provides a way to profile code symfony/string v6.3.0 Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way symfony/translation v6.3.0 Provides tools to internationalize your application symfony/translation-contracts v3.3.0 Generic abstractions related to translation theseer/tokenizer 1.2.1 A small library for converting tokenized PHP source code into XML and potentially other formats vlucas/phpdotenv v5.5.0 Loads environment variables from
.env
togetenv()
,$_ENV
and$_SERVER
automagically.下图为AlmaLinux下正常使用的截图(当然,还有些小瑕疵)
下图为Windows 10下发生错误的截图