Giter Site home page Giter Site logo

swoft-cloud / swoft-cli Goto Github PK

View Code? Open in Web Editor NEW
47.0 8.0 17.0 320 KB

🛠️ Command line tool for quick use swoft. Support create new application, generate class, hot reload server and more.

Home Page: https://www.swoft.org/docs

License: Apache License 2.0

PHP 98.46% Makefile 1.54%
swoft swoft-application swoft-cli swoft-console

swoft-cli's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swoft-cli's Issues

todo

支持通过配置文件运行

{
	"project1": {
		"path": "/some/path",
		"pidFile": "/some/path/project1.pid"
	},
	"project1": {
		"path": "/some/path",
		"pidFile": "/some/path/project1.pid"
	}
}

win-docker下启动报错

环境 win10-docker-centos7

docker下的centos7默认没有安装which
php swoftcli.phar run -c ws:start 会报错

解决办法,安装which yum install -y which

然后在启动就可以了

提交一下,就当给其他遇到同样问题的同学提个醒吧

创建application报错

Ensure create application ?
Please confirm(yes|no)[default:yes]: yes
> cd /var/folders/_c/95br9t151ylcns_q78qh8sx80000gn/T/swoft-app-demos && git clone --no-tags --depth 1 https://github.com/swoft-cloud/swoft-tcp-project.git

--no-tags 低版本git不支持

Mac httpserver重启失败

2019/07/23-14:57:46 [INFO] Swoft\Redis\Listener\WorkerStopAndErrorListener:handle(52) Close 0 redis connection on workerStop!
2019/07/23-14:57:46 [INFO] Swoft\Db\Listener\WorkerStopAndErrorListener:handle(50) Close 0 database connection on workerStop!
2019/07/23-14:57:46 [INFO] Swoft\Db\Listener\WorkerStopAndErrorListener:handle(50) Close 0 database connection on workerStop!
2019/07/23-14:57:46 [INFO] Swoft\Db\Listener\WorkerStopAndErrorListener:handle(50) Close 0 database connection on workerStop!
2019/07/23-14:57:46 [INFO] Swoft\Db\Listener\WorkerStopAndErrorListener:handle(50) Close 0 database connection on workerStop!
2019/07/23-14:57:46 [INFO] Swoft\Db\Listener\WorkerStopAndErrorListener:handle(50) Close 0 database connection on workerStop!
2019/07/23-14:57:46 [INFO] Swoft\Db\Listener\WorkerStopAndErrorListener:handle(50) Close 0 database connection on workerStop!
[2019-07-23 14:57:47 #84709.2] INFO Server is shutdown now
[2019-07-23 14:57:48 #84709.2] INFO Server is shutdown now
[2019-07-23 14:57:49 #84709.2] INFO Server is shutdown now
[ERROR] Stop sever is failed

启动后就报错

Work Information
current pid 95624
current dir /Applications/MAMP/htdocs/swoft
php binFile php
target path /Applications/MAMP/htdocs/swoft
watch dirs app, config
entry file /Applications/MAMP/htdocs/swoft/bin/swoft
execute cmd php /Applications/MAMP/htdocs/swoft/bin/swoft http:start

Watched Directories
/Applications/MAMP/htdocs/swoft/app
/Applications/MAMP/htdocs/swoft/config

[SWOFTCLI] Start swoft server
[SWOFTCLI] Server(pid 95627) exited (signal 0, code 255)
[SWOFTCLI] Server non-zero status exit
restart?(y/n) >

无法单独创建tcp应用

在创建单独的tcp应用时报错:
php swoftcli.phar create:app --debug 4 --refresh --type tcp node

Ensure create application ?
Please confirm(yes|no)[default:yes]: yes

cd /var/folders/c4/hg4h6syj5x1d5qq33bldkr1c0000gn/T/swoft-app-demos && git clone --depth 1 https://github.com/swoft-cloud/swoft-tcp-project.git
Cloning into 'swoft-tcp-project'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.

  • Copy project files from local cache
  • Remove .git directory on new project

cp -R /var/folders/c4/hg4h6syj5x1d5qq33bldkr1c0000gn/T/swoft-app-demos/swoft-tcp-project /xxx/devel/php/node && rm -rf /xxx/devel/php/node/.git

  • Project: /xxx/devel/php/node created
  • Begin run composer install for init project

cd /xxx/devel/php/node && composer install
Composer could not find a composer.json file in /xxx/devel/php/node
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
[ERROR] exec command fail

https://github.com/swoft-cloud/swoft-tcp-project.git 是空的

Uncaught ErrorException: Uncaught ErrorException: Swoole\Process::exec():

Fatal error: Uncaught ErrorException: Uncaught ErrorException: Swoole\Process::exec(): exec file name is empty in phar:///usr/local/bin/swoftcli/app/Command/ServeCommand.php:287
Stack trace:
#0 [internal function]: Swoft\Error\DefaultErrorDispatcher->handleError(2, 'Swoole\\Process:...', 'phar:///usr/loc...', 287, Array)
#1 phar:///usr/local/bin/swoftcli/app/Command/ServeCommand.php(287): Swoole\Process->exec('', Array)
#2 [internal function]: Swoft\Cli\Command\ServeCommand->Swoft\Cli\Command\{closure}(Object(Swoole\Process))
#3 phar:///usr/local/bin/swoftcli/app/Command/ServeCommand.php(290): Swoole\Process->start()
#4 phar:///usr/local/bin/swoftcli/app/Command/ServeCommand.php(235): Swoft\Cli\Command\ServeCommand->startServer()
#5 phar:///usr/local/bin/swoftcli/vendor/swoft/console/src/ConsoleDispatcher.php(46): Swoft\Cli\Command\ServeCommand->run(Object(Swoft\Console\Input\Input))
#6 phar:///usr/local/bin/swoftcli/vendor/swoft/console/src/Application.php(213): Swoft\Console\ConsoleDispatcher->dispatch(Array)
#7 phar:// in phar:///usr/local/bin/swoftcli/app/Command/ServeCommand.php on line 287

[Semantical Error] Annotation was never imported

Doctrine\Common\Annotations\AnnotationException(code:0) [Semantical Error] The annotation "@AnnotationParser" in class Swoft\Validator\Annotation\Parser\AfterDateParser was never imported. Did you maybe forget to add a "use" statement for this annotation?

Screenshot from 2020-12-06 02-31-58

gen生成代码问题

image

不知道开发注意到了吗,这里生成代码有个命名空间的拼写错误,会导致生成的命令无法使用。

composer install fail

Problem 1
- The requested package swoft-project/basic-template could not be found in any version, there may be a typo in the package name.

php升级到7.4.0报错

PHP: 7.4.0, Swoft: 2.0.7, Swoole: 4.4.13RC2

PHP Fatal error: Uncaught ErrorException: Array and string offset access syntax with curly braces is deprecated in phar:///usr/local/bin/swoftcli/vendor/toolkit/cli-utils/src/Flags.php:313
Stack trace:
#0 phar:///usr/local/bin/swoftcli/vendor/swoft/error/src/DefaultErrorDispatcher.php(64): Swoft\Error\DefaultErrorDispatcher->handleError(8192, 'Array and strin...', 'phar:///usr/loc...', 313)
#1 [internal function]: Swoft\Error\DefaultErrorDispatcher->Swoft\Error{closure}()
#2 {main}
thrown in phar:///usr/local/bin/swoftcli/vendor/toolkit/cli-utils/src/Flags.php on line 313

Fatal error: Uncaught ErrorException: Array and string offset access syntax with curly braces is deprecated in phar:///usr/local/bin/swoftcli/vendor/toolkit/cli-utils/src/Flags.php:313
Stack trace:
#0 phar:///usr/local/bin/swoftcli/vendor/swoft/error/src/DefaultErrorDispatcher.php(64): Swoft\Error\DefaultErrorDispatcher->handleError(8192, 'Array and strin...', 'phar:///usr/loc...', 313)
#1 [internal function]: Swoft\Error\DefaultErrorDispatcher->Swoft\Error{closure}()
#2 {main}
thrown in phar:///usr/local/bin/swoftcli/vendor/toolkit/cli-utils/src/Flags.php on line 313

多版本php共存的情况下,cli工具启动报错

mac的版本是 7.1.23,但是没有为其安装swoole扩展
自己编译安装了7.2.7,安装了swoole扩展。并将php的环境变量指定到了7.2下面:
export PATH=/usr/local/Cellar/php72/7.2.7/bin/php:$PATH
问题来了使用如下脚本的时候 报错了
php bin/swoftcli.phar run -c http:start -b bin/swoft /var/www/myswoft/

其使用的php路径依旧是系统自带的,而不是我指定的,控制台日志:

Work Information
  current pid 1505
  current dir /Users/xxxx/Documents/www/myswoft
  php binFile /usr/bin/php
  target path /var/www/myswoft/
  watch dirs  app, config
  entry file  /var/www/myswoft//bin/swoft
  **execute cmd /usr/bin/php /var/www/myswoft//bin/swoft http:start**///usr/bin/php -v 是系统的7.1

Watched Directories
  /var/www/myswoft//app
  /var/www/myswoft//config

2019/10/15-07:52:17 [SWOFTCLI] Start swoft server

Fatal error: Uncaught Error: Class 'Swoole\Coroutine' not found in /Users/xxxx/Documents/www/myswoft/bin/swoft:7

v0.1.3 启用报错

root@be24a4009222:/var/www# php swoftcli.phar

Fatal error: Uncaught PharException: phar "/var/www/swoftcli.phar" has a broken signature in /var/www/swoftcli.phar:9
Stack trace:
#0 /var/www/swoftcli.phar(9): Phar::mapPhar('swoftcli.phar')
#1 {main}
thrown in /var/www/swoftcli.phar on line 9

其他系统信息:
root@be24a4009222:/var/www# which php
/usr/local/bin/php

root@be24a4009222:/var/www# php -v
PHP 7.2.23 (cli) (built: Oct 17 2019 15:52:12) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

root@be24a4009222:/var/www# php -i | grep phar
Registered PHP Streams => https, ftps, compress.zlib, php, file, glob, data, http, ftp, phar, zip
Phar-based phar archives => enabled
Tar-based phar archives => enabled
ZIP-based phar archives => enabled
phar.cache_list => no value => no value
phar.readonly => On => On
phar.require_hash => On => On
root@be24a4009222:/var/www#

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.