scil / laravelfly Goto Github PK
View Code? Open in Web Editor NEWTo be an absolutely safe solution to speed up Laravel with Swoole. Preloading + Coroutine and Tinker Online.
To be an absolutely safe solution to speed up Laravel with Swoole. Preloading + Coroutine and Tinker Online.
https://github.com/scil/LaravelFly/wiki/Configuration
修改
class WhichKernel extends \LaravelFly\MidKernel{}
为
class WhichKernel extends \LaravelFly\Kernel{}
src/LaravelFly/Map/Util/Dict.php中,修改if (static::$normalAttriForObj ?? false) {
为 if (isset(static::$normalAttriForObj)) {
类似的还有
static::$arrayAttriForObj
,static::$arrayStaticAttri
When i execute php vendor/scil/laravel-fly/bin/fly start
, the ternimal display error with
Fatal error: Uncaught Error: Class 'Psy\Input\ShellInput' not found in /www/wwwroot/zdd/vendor/scil/laravel-fly/src/LaravelFly/Server/Traits/Console.php:38
Is there any plans to add support for Postgresql?
Currently I see for mysql using SwooleMySQLConnection
& CoroutineMySQLConnector
from Hhxsv5\LaravelS\Illuminate\Database
Coroutine Postgresql also supported in Swoole since > 6 months ago:
https://github.com/swoole/swoole-src/blob/master/examples/postgresql/postgresql_coro.php
I can make a PR to add it, if you like?
Laravel: 5.6
composer require "scil/laravel-fly":"dev-master"
When trying to install it on laravel 5.6 I get the dependency error:
Problem 1
- Installation request for scil/laravel-fly dev-master -> satisfiable by scil/laravel-fly[dev-master].
- Conclusion: remove nikic/php-parser v4.0.1
- Conclusion: don't install nikic/php-parser v4.0.1
- scil/laravel-fly dev-master requires classpreloader/classpreloader ^3.2 -> satisfiable by classpreloader/classpreloader[3.2.0, 3.2.x-dev].
- classpreloader/classpreloader 3.2.0 requires nikic/php-parser ^1.0|^2.0|^3.0 -> satisfiable by nikic/php-parser[1.x-dev, 2.x-dev, 3.x-dev, v1.0.0, v1.0.0beta1, v1.0.0
beta2, v1.0.1, v1.0.2, v1.1.0, v1.2.0, v1.2.1, v1.2.2, v1.3.0, v1.4.0, v1.4.1, v2.0.0, v2.0.0alpha1, v2.0.0beta1, v2.0.1, v2.1.0, v2.1.1, v3.0.0, v3.0.0alpha1, v3.0.0beta1,
v3.0.0beta2, v3.0.1, v3.0.2, v3.0.3, v3.0.4, v3.0.5, v3.0.6, v3.1.0, v3.1.1, v3.1.2, v3.1.3, v3.1.4, v3.1.5].
- classpreloader/classpreloader 3.2.x-dev requires nikic/php-parser ^1.0|^2.0|^3.0 -> satisfiable by nikic/php-parser[1.x-dev, 2.x-dev, 3.x-dev, v1.0.0, v1.0.0beta1, v1
.0.0beta2, v1.0.1, v1.0.2, v1.1.0, v1.2.0, v1.2.1, v1.2.2, v1.3.0, v1.4.0, v1.4.1, v2.0.0, v2.0.0alpha1, v2.0.0beta1, v2.0.1, v2.1.0, v2.1.1, v3.0.0, v3.0.0alpha1, v3.0.0be
ta1, v3.0.0beta2, v3.0.1, v3.0.2, v3.0.3, v3.0.4, v3.0.5, v3.0.6, v3.1.0, v3.1.1, v3.1.2, v3.1.3, v3.1.4, v3.1.5].
- Can only install one of: nikic/php-parser[1.x-dev, v4.0.1].
- Can only install one of: nikic/php-parser[2.x-dev, v4.0.1].
- Can only install one of: nikic/php-parser[3.x-dev, v4.0.1].
- Can only install one of: nikic/php-parser[v1.3.0, v4.0.1].
- Can only install one of: nikic/php-parser[v1.4.0, v4.0.1].
- Can only install one of: nikic/php-parser[v1.4.1, v4.0.1].
- Can only install one of: nikic/php-parser[v2.0.0, v4.0.1].
- Can only install one of: nikic/php-parser[v2.0.0alpha1, v4.0.1].
- Can only install one of: nikic/php-parser[v2.0.0beta1, v4.0.1].
- Can only install one of: nikic/php-parser[v2.0.1, v4.0.1].
- Can only install one of: nikic/php-parser[v2.1.0, v4.0.1].
- Can only install one of: nikic/php-parser[v2.1.1, v4.0.1].
- Can only install one of: nikic/php-parser[v3.0.0, v4.0.1].
- Can only install one of: nikic/php-parser[v3.0.0alpha1, v4.0.1].
- Can only install one of: nikic/php-parser[v3.0.0beta1, v4.0.1].
- Can only install one of: nikic/php-parser[v3.0.0beta2, v4.0.1].
- Can only install one of: nikic/php-parser[v3.0.1, v4.0.1].
- Can only install one of: nikic/php-parser[v3.0.2, v4.0.1].
- Can only install one of: nikic/php-parser[v3.0.3, v4.0.1].
- Can only install one of: nikic/php-parser[v3.0.4, v4.0.1].
- Can only install one of: nikic/php-parser[v3.0.5, v4.0.1].
- Can only install one of: nikic/php-parser[v3.0.6, v4.0.1].
- Can only install one of: nikic/php-parser[v3.1.0, v4.0.1].
- Can only install one of: nikic/php-parser[v3.1.1, v4.0.1].
- Can only install one of: nikic/php-parser[v3.1.2, v4.0.1].
- Can only install one of: nikic/php-parser[v3.1.3, v4.0.1].
- Can only install one of: nikic/php-parser[v3.1.4, v4.0.1].
- Can only install one of: nikic/php-parser[v3.1.5, v4.0.1].
- Can only install one of: nikic/php-parser[v1.0.0, v4.0.1].
- Can only install one of: nikic/php-parser[v1.0.0beta1, v4.0.1].
- Can only install one of: nikic/php-parser[v1.0.0beta2, v4.0.1].
- Can only install one of: nikic/php-parser[v1.0.1, v4.0.1].
- Can only install one of: nikic/php-parser[v1.0.2, v4.0.1].
- Can only install one of: nikic/php-parser[v1.1.0, v4.0.1].
- Can only install one of: nikic/php-parser[v1.2.0, v4.0.1].
- Can only install one of: nikic/php-parser[v1.2.1, v4.0.1].
- Can only install one of: nikic/php-parser[v1.2.2, v4.0.1].
- Installation request for nikic/php-parser (locked at v4.0.1) -> satisfiable by nikic/php-parser[v4.0.1].
Installation failed, reverting ./composer.json to its original content.
According to the documentation of Swoole version greater than 2.0 will not work with xdebug but I see you mentioned the xdebug config here https://github.com/scil/LaravelFly/blob/master/doc/server.md are you able to find a work around for it?
laravelFly
在9501端口正常启动,nginx
反向代理到9501, 本地请求成功,CORS.php
中间件并在kernel
注册, PHP-FPM
模式下可以跨域. 但使用laraveFly
后不能跨域。请问有跨域方面的尝试吗, 或者提示也行...
PS:laravoole
也不能跨域
Laravel Version: 5.7.27
I ran the following command:
composer require "scil/laravel-fly":"dev-master"
I got the following error:
Problem 1
- scil/laravel-fly-files v5.6.39.4 requires laravel/framework 5.6.39 -> satisfiable by laravel/framework[v5.6.39] but these conflict with your requirements or minimum-stability.
- scil/laravel-fly-files v5.6.39.3 requires laravel/framework 5.6.39 -> satisfiable by laravel/framework[v5.6.39] but these conflict with your requirements or minimum-stability.
- scil/laravel-fly-files v5.6.39.2 requires laravel/framework 5.6.39 -> satisfiable by laravel/framework[v5.6.39] but these conflict with your requirements or minimum-stability.
- scil/laravel-fly-files v5.6.39.1 requires laravel/framework 5.6.39 -> satisfiable by laravel/framework[v5.6.39] but these conflict with your requirements or minimum-stability.
- scil/laravel-fly-files v5.6.38.7 requires laravel/framework 5.6.38 -> satisfiable by laravel/framework[v5.6.38] but these conflict with your requirements or minimum-stability.
- scil/laravel-fly-files v5.6.38.6 requires laravel/framework 5.6.38 -> satisfiable by laravel/framework[v5.6.38] but these conflict with your requirements or minimum-stability.
- scil/laravel-fly-files v5.6.38.5 requires laravel/framework 5.6.38 -> satisfiable by laravel/framework[v5.6.38] but these conflict with your requirements or minimum-stability.
- scil/laravel-fly-files v5.6.38.4 requires laravel/framework 5.6.38 -> satisfiable by laravel/framework[v5.6.38] but these conflict with your requirements or minimum-stability.
- scil/laravel-fly-files v5.6.38.3 requires laravel/framework 5.6.38 -> satisfiable by laravel/framework[v5.6.38] but these conflict with your requirements or minimum-stability.
- scil/laravel-fly-files v5.6.38.2 requires laravel/framework 5.6.38 -> satisfiable by laravel/framework[v5.6.38] but these conflict with your requirements or minimum-stability.
- scil/laravel-fly-files v5.6.38.1 requires laravel/framework 5.6.38 -> satisfiable by laravel/framework[v5.6.38] but these conflict with your requirements or minimum-stability.
- scil/laravel-fly-files v5.5.4402 requires laravel/framework 5.5.44 -> satisfiable by laravel/framework[v5.5.44] but these conflict with your requirements or minimum-stability.
- scil/laravel-fly-files v5.5.4401 requires laravel/framework 5.5.44 -> satisfiable by laravel/framework[v5.5.44] but these conflict with your requirements or minimum-stability.
- scil/laravel-fly-files v5.5.4307 requires laravel/framework 5.5.43 -> satisfiable by laravel/framework[v5.5.43] but these conflict with your requirements or minimum-stability.
- scil/laravel-fly-files v5.5.4306 requires laravel/framework 5.5.43 -> satisfiable by laravel/framework[v5.5.43] but these conflict with your requirements or minimum-stability.
- scil/laravel-fly-files v5.5.4305 requires laravel/framework 5.5.43 -> satisfiable by laravel/framework[v5.5.43] but these conflict with your requirements or minimum-stability.
- scil/laravel-fly-files v5.5.4304 requires laravel/framework 5.5.43 -> satisfiable by laravel/framework[v5.5.43] but these conflict with your requirements or minimum-stability.
- scil/laravel-fly-files v5.5.4303 requires laravel/framework 5.5.43 -> satisfiable by laravel/framework[v5.5.43] but these conflict with your requirements or minimum-stability.
- scil/laravel-fly-files v5.5.4302 requires laravel/framework 5.5.43 -> satisfiable by laravel/framework[v5.5.43] but these conflict with your requirements or minimum-stability.
- scil/laravel-fly-files v5.5.4301 requires laravel/framework 5.5.43 -> satisfiable by laravel/framework[v5.5.43] but these conflict with your requirements or minimum-stability.
- scil/laravel-fly-files v5.5.43 requires laravel/framework 5.5.43 -> satisfiable by laravel/framework[v5.5.43] but these conflict with your requirements or minimum-stability.
- scil/laravel-fly-files v5.5.4001 requires laravel/framework 5.5.40 -> satisfiable by laravel/framework[v5.5.40] but these conflict with your requirements or minimum-stability.
- scil/laravel-fly-files 5.6.x-dev requires laravel/framework 5.6.39 -> satisfiable by laravel/framework[v5.6.39] but these conflict with your requirements or minimum-stability.
- scil/laravel-fly-files 5.5.x-dev requires laravel/framework 5.5.44 -> satisfiable by laravel/framework[v5.5.44] but these conflict with your requirements or minimum-stability.
- scil/laravel-fly dev-master requires scil/laravel-fly-files 5.5.* || 5.6.* || 5.7.* -> satisfiable by scil/laravel-fly-files[5.5.x-dev, 5.6.x-dev, v5.5.4001, v5.5.43, v5.5.4301, v5.5.4302, v5.5.4303, v5.5.4304, v5.5.4305, v5.5.4306, v5.5.4307, v5.5.4401, v5.5.4402, v5.6.38.1, v5.6.38.2, v5.6.38.3, v5.6.38.4, v5.6.38.5, v5.6.38.6, v5.6.38.7, v5.6.39.1, v5.6.39.2, v5.6.39.3, v5.6.39.4].
- Installation request for scil/laravel-fly dev-master -> satisfiable by scil/laravel-fly[dev-master].
Installation failed, reverting ./composer.json to its original content.
能兼容laravel很好,问题是协程中不能使用任何阻塞的代码,数据库、redis以及rpc等都不能是阻塞的,但是我并没有看到有协程客户端封装,如果用的laravel原生的就会有问题吧
rt.
thx
😄
My docker-compose
#Docker Networks
networks:
app-network:
driver: bridge
services:
app:
build: php-fpm
container_name: app
restart: always
ports:
- "9501:9501"
# - "9000:9000"
# - "81:81"
expose:
- 80
- 9501
- 9000
# entrypoint: "php vendor/scil/laravel-fly/bin/fly start"
entrypoint: "php-fpm"
environment:
SERVICE_NAME: app
SERVICE_TAGS: dev
volumes:
- ${APP_PATH_HOST}:${APP_PATH_CONTAINER}
- ./php-fpm/config:/usr/local/etc/php
working_dir: ${APP_PATH_CONTAINER}
networks:
- app-network
#Nginx Service
nginx:
build: nginx
restart: always
ports:
- "80:80"
- "443:443"
networks:
- app-network
working_dir: /app
volumes:
- ${APP_PATH_HOST}/public:/usr/share/nginx/html
- ./nginx/conf.d/app.conf:/etc/nginx/nginx.conf
command: [nginx-debug, '-g', 'daemon off;']
db:
image: mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: 123456
volumes:
- ${DB_PATH_HOST}:/var/lib/mysql
command: --default-authentication-plugin=mysql_native_password
ports:
- "3306:3306"
networks:
- app-network
adminer:
image: adminer
restart: always
ports:
- "6080:8080"
networks:
- app-network
My nginx app.conf
user www-data www-data;
worker_processes 5;
pid /var/run/nginx.pid;
worker_rlimit_nofile 1024;
# include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 512;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile off;
tcp_nopush on;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log warn;
upstream default {
server app:9501 weight=1 max_fails=1 fail_timeout=10 ;
server app:81 backup;
# The connections parameter sets the maximum number of idle keepalive connections to upstream servers that are preserved in the cache of each worker process. When this number is exceeded, the least recently used connections are closed.
# It does not limit the total number of connections to upstream servers that an nginx worker process can open. The connections parameter should be set to a number small enough to let upstream servers process new incoming connections as well.
# https://gist.github.com/magnetikonline/4a2e68b2ce94bd0c945e
# https://ma.ttias.be/enable-keepalive-connections-in-nginx-upstream-proxy-configurations/
keepalive 8;
}
upstream swoole {
server app:9501;
}
upstream fpm {
server app:81;
}
# map to different upstream backends based on query parameter 'useserver'
# visit http://fly.test/?useserver=swoole to use server swoole
# visit http://fly.test to use upstream default
map $arg_useserver $pool {
default "default";
swoole "swoole";
fpm "fpm";
}
log_format my_upstream '$remote_addr|$time_local|$request_time|$upstream_response_time|$status '
'$upstream_addr|$request';
server {
server_name fly.test;
listen 80;
root /usr/share/nginx/html;
index index.html;
charset utf-8;
location = / {
# if you have a static home page , try this one:
# try_files index.html @other;
try_files '' @php;
}
location / {
try_files $uri $uri/ @php;
}
location @php {
proxy_pass http://$pool;
# Default is HTTP/1, keepalive is only enabled in HTTP/1.1
proxy_http_version 1.1;
# Remove the Connection header if the client sends it,
# it could be "close" to close a keepalive connection
proxy_set_header Connection "";
# proxy_connect_timeout 60s;
# proxy_send_timeout 60s;
# proxy_read_timeout 120s;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
# proxy_set_header X-Real-PORT $remote_port;
# proxy_set_header Scheme $scheme;
# proxy_set_header Server-Protocol $server_protocol;
# proxy_set_header Server-Name $server_name;
# proxy_set_header Server-Addr $server_addr;
# proxy_set_header Server-Port $server_port;
# just a mark for different upstream server, you can disable it
add_header X-Upstream $upstream_addr;
# log
access_log /var/log/nginx/upstream.log my_upstream;
}
# # only for Let's Encrypt
# location ~ /.well-known {
# allow all;
# # set root is necessage, otherwise "Invalid response from domain..."
# # https://www.digitalocean.com/community/questions/letsencrypt-problem-renewing-certs-invalid-response-from-domain
# root {{ doc_root }};
# }
}
server {
server_name fly.test;
listen 81;
root /usr/share/nginx/html;
index index.html index.php;
charset utf-8;
location / {
try_files '' /index.php?$query_string;
}
location /index.php {
fastcgi_pass app:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
}
}
Swoole works well, but php-fpm always get 502 bad gateway
in my laravel 5.6 application I am getting a strange error on every request.
What is possibaly going wrong here?
Symfony\Component\Debug\Exception\FatalThrowableError thrown with message "Function name must be a string"
Stacktrace:
#6 Symfony\Component\Debug\Exception\FatalThrowableError in /srv/site-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:152
#5 LaravelFly\Server\HttpServer:onRequest in /srv/site-laravel/vendor/scil/laravel-fly/src/LaravelFly/Server/HttpServer.php:0
#4 Swoole\Http\Server:start in /srv/site-laravel/vendor/scil/laravel-fly/src/LaravelFly/Server/Common.php:273
#3 LaravelFly\Server\HttpServer:start in /srv/site-laravel/vendor/scil/laravel-fly/src/LaravelFly/Server/HttpServer.php:26
#2 LaravelFly\Server\HttpServer:start in /srv/site-laravel/vendor/scil/laravel-fly/src/LaravelFly/Fly.php:70
#1 LaravelFly\Fly:start in /srv/site-laravel/vendor/scil/laravel-fly/bin/fly:78
#0 {main} in /srv/site-laravel/vendor/scil/laravel-fly/bin/fly:0
Using version ^0.9.2 for scil/laravel-fly
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
- scil/laravel-fly-files v5.5.4302 requires laravel/framework 5.5.43 -> satisfiable by laravel/framework[v5.5.43] but these conflict with your requirements or minimum-stability.
- scil/laravel-fly-files v5.5.4301 requires laravel/framework 5.5.43 -> satisfiable by laravel/framework[v5.5.43] but these conflict with your requirements or minimum-stability.
- scil/laravel-fly-files v5.5.43 requires laravel/framework 5.5.43 -> satisfiable by laravel/framework[v5.5.43] but these conflict with your requirements or minimum-stability.
- scil/laravel-fly-files v5.5.4001 requires laravel/framework 5.5.40 -> satisfiable by laravel/framework[v5.5.40] but these conflict with your requirements or minimum-stability.
- scil/laravel-fly-files 5.5.x-dev requires laravel/framework 5.5.43 -> satisfiable by laravel/framework[v5.5.43] but these conflict with your requirements or minimum-stability.
- Installation request for scil/laravel-fly ^0.9.2 -> satisfiable by scil/laravel-fly[v0.9.2].
- Can only install one of: laravel/framework[v5.6.35, v5.6.28].
- Can only install one of: laravel/framework[v5.6.28, v5.6.35].
- Can only install one of: laravel/framework[v5.6.28, v5.6.35].
- scil/laravel-fly-files 5.6.x-dev requires laravel/framework 5.6.28 -> satisfiable by laravel/framework[v5.6.28].
- scil/laravel-fly v0.9.2 requires scil/laravel-fly-files 5.5.* || 5.6.* -> satisfiable by scil/laravel-fly-files[5.5.x-dev, 5.6.x-dev, v5.5.4001, v5.5.43, v5.5.4301, v5.5.4302, v5.6.38.1, v5.6.38.2].
- scil/laravel-fly-files v5.6.38.1 requires laravel/framework 5.6.38 -> satisfiable by laravel/framework[v5.6.38].
- scil/laravel-fly-files v5.6.38.2 requires laravel/framework 5.6.38 -> satisfiable by laravel/framework[v5.6.38].
- Conclusion: don't install laravel/framework v5.6.38
- Installation request for laravel/framework (locked at v5.6.35, required as 5.6.*) -> satisfiable by laravel/framework[v5.6.35].
Installation failed, reverting ./composer.json to its original content.
I successfully installed the LaravelFly via
composer require "scil/laravel-fly":"dev-master"
But when when I goto vendor/bin/ folder I don't see
the fly
executable there What could I be doing wrong here?
'providers' => [
/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
/*
* Package Service Providers...
*/
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
Laravel\Passport\PassportServiceProvider::class,
SimpleSoftwareIO\QrCode\QrCodeServiceProvider::class,
Intervention\Image\ImageServiceProvider::class,
\Yangyifan\Upload\UploadServiceProvider::class,
\App\Providers\Cee\Volunteer\VolunteerProvider::class,
App\Providers\Cee\Major\EvaluationProvider::class,
App\Providers\Im\TimProvider::class,
//Hhxsv5\LaravelS\Illuminate\LaravelSServiceProvider::class,
Silber\PageCache\LaravelServiceProvider::class,
],
#0 /www/htdocs/vendor/scil/laravel-fly-files/src/Container.php(701): ReflectionClass->__construct('files')
#1 /www/htdocs/vendor/scil/laravel-fly-files/src/Container.php(578): Illuminate\Container\Container->build('files')
#2 /www/htdocs/vendor/scil/laravel-fly-files/src/Container.php(533): Illuminate\Container\Container->resolve('files', -1, Array)
#3 /www/htdocs/vendor/scil/laravel-fly-files/src/Application.php(697): Illuminate\Container\Container->make('files', Array)
#4 /www/htdocs/vendor/scil/laravel-fly-files/src/Container.php(1154): Illuminate\Foundation\Application->make('files')
#5 /www/htdocs/vendor/barryvdh/laravel-ide-helper/src/IdeHelperServiceProvider.php(118): Illuminate\Container\Container->offsetGet('files')
#6 /www/htdocs/vendor/barryvdh/laravel-ide-he#0 /www/htdocs/vendor/scil/laravel-fly-files/src/Container.php(701): ReflectionClass->__construct('files')
#1 /www/htdocs/vendor/scil/laravel-fly-files/src/Container.php(578): Illuminate\Container\Container->build('files')
#2 /www/htdocs/vendor/scil/laravel-fly-files/src/Container.php(533): Illuminate\Container\Container->resolve('files', -1, Array)
#3 /www/htdocs/vendor/scil/laravel-fly-files/src/Application.php(697): Illuminate\Container\Container->make('files', Array)
#4 /www/htdocs/vendor/scil/laravel-fly-files/src/Container.php(1154): Illuminate\Foundation\Application->make('files')
#5 /www/htdocs/vendor/barryvdh/laravel-ide-helper/src/IdeHelperServiceProvider.php(118): Illuminate\Container\Container->offsetGet('files')
#6 /www/htdocs/vendor/barryvdh/laravel-ide-helper/src/IdeHelperServiceProvider.php(61): Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider->createLocalViewFactory()
#7 /www/htdocs/vendor/scil/laravel-fly-files/src/Application.php(546): Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider->register()
#8 /www/htdocs/app/Providers/AppServiceProvider.php(53): Illuminate\Foundation\Application->register(Object(Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider))
#9 /www/htdocs/vendor/scil/laravel-fly-files/src/Application.php(546): App\Providers\AppServiceProvider->register()
#10 /www/htdocs/vendor/scil/laravel-fly/src/LaravelFly/Backup/ProviderRepository.php(28): Illuminate\Foundation\Application->register(Object(App\Providers\AppServiceProvider))
#11 /www/htdocs/vendor/scil/laravel-fly/src/LaravelFly/Map/Application.php(242): LaravelFly\Backup\ProviderRepository->load(Array)
#12 /www/htdocs/vendor/scil/laravel-fly/src/LaravelFly/Map/Bootstrap/RegisterAcrossProviders.php(10): LaravelFly\Map\Application->registerAcrossProviders()
#13 /www/htdocs/vendor/scil/laravel-fly-files/src/Application.php(172): LaravelFly\Map\Bootstrap\RegisterAcrossProviders->bootstrap(Object(LaravelFly\Map\Application))
#14 /www/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(162): Illuminate\Foundation\Application->bootstrapWith(Array)
#15 /www/htdocs/vendor/scil/laravel-fly/src/LaravelFly/Server/Traits/Laravel.php(90): Illuminate\Foundation\Http\Kernel->bootstrap()
#16 /www/htdocs/vendor/scil/laravel-fly/src/LaravelFly/Server/HttpServer.php(32): LaravelFly\Server\Common->startLaravel()
#17 [internal function]: LaravelFly\Server\HttpServer->onWorkerStart(Object(Swoole\Http\Server), 3)
#18 /www/htdocs/vendor/scil/laravel-fly/src/LaravelFly/Server/Common.php(311): Swoole\Http\Server->start()
#19 /www/htdocs/vendor/scil/laravel-fly/src/LaravelFly/Server/HttpServer.php(23): LaravelFly\Server\Common->start()
#20 /www/htdocs/vendor/scil/laravel-fly/bin/fly(84): LaravelFly\Server\HttpServer->start()
#21 {main}[FLY ERROR] bootstrap: Class files does not exist
laravel exception message :InvalidStateException in AbstractProvider.php line 218
After I check, seems to be the session is unavailable
Would it be possible for you to show a docker example of this running?
Octobercms 是基于laravel的cms系统。一直想用swoole加速下运行效率!麻烦大神帮忙看看可有什么可行法案啊?谢谢.(https://github.com/octobercms)
How to get "php://input" data in laravel.
$_GET/$_POST/$_FILES...These all have, But there is no "php://input".
Can you tell me what to do?
My mac probook
ram:8G ram
cpu: i5
when i use your default config in laravelfly.server.php , cpu goes up to nearly 100% , when i change to config below , about 30% down ,is there anything wrong in your script ?
The class \Illuminate\Support\Facades\Facade
will cache the resolved instances into $resolvedInstance variable , which might be available for another coroutine, I am wondering how this package resolve this issue, I checked all source codes, it seems there is no code for this logic, can anybody explain this please?
使用默认配置 start后报错
[INFO] conf: /opt/www/laravel-test/fly.conf.php
[INFO] server dispatcher created
[INFO] event server.config
[INFO] include: /opt/www/laravel-test/bootstrap/cache/laravelfly_preload.php
[WARN] kernel: LaravelFly\Kernel
[INFO] event server.created for LaravelFly\Server\HttpServer
[INFO] event worker.starting for 0 (pid 24042)
[INFO] event worker.starting for 1 (pid 24043)
[INFO] event worker.starting for 2 (pid 24044)
[INFO] event worker.starting for 3 (pid 24045)
[INFO] event worker.starting for 4 (pid 24046)
[INFO] event app.created for \LaravelFly\Simple\Application (pid 24043)
[INFO] event app.created for \LaravelFly\Simple\Application (pid 24044)
[INFO] event app.created for \LaravelFly\Simple\Application (pid 24045)
[INFO] event app.created for \LaravelFly\Simple\Application (pid 24042)
[INFO] event app.created for \LaravelFly\Simple\Application (pid 24046)
[ERROR] bootstrap: Whoops\Exception\ErrorException: array_diff(): Argument #2 is not an array in /opt/www/laravel-test/vendor/scil/laravel-fly/src/LaravelFly/Simple/Bootstrap/LoadConfiguration.php:39
Stack trace:
#0 [internal function]: Whoops\Run->handleError(2, 'array_diff(): A...', '/opt/www/larave...', 39, Array)
#1 /opt/www/laravel-test/vendor/scil/laravel-fly/src/LaravelFly/Simple/Bootstrap/LoadConfiguration.php(39): array_diff(Array, NULL, NULL)
#2 /opt/www/laravel-test/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(206): LaravelFly\Simple\Bootstrap\LoadConfiguration->bootstrap(Object(LaravelFly\Simple\Application))
#3 /opt/www/laravel-test/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(162): Illuminate\Foundation\Application->bootstrapWith(Array)
#4 /opt/www/laravel-test/vendor/scil/laravel-fly/src/LaravelFly/Server/HttpServer.php(59): Illuminate\Foundation\Http\Kernel->bootstrap()
#5 {main}
[ERROR] bootstrap: Whoops\Exception\ErrorException: array_diff(): Argument #2 is not an array in /opt/www/laravel-test/vendor/scil/laravel-fly/src/LaravelFly/Simple/Bootstrap/LoadConfiguration.php:39
Stack trace:
#0 [internal function]: Whoops\Run->handleError(2, 'array_diff(): A...', '/opt/www/larave...', 39, Array)
#1 /opt/www/laravel-test/vendor/scil/laravel-fly/src/LaravelFly/Simple/Bootstrap/LoadConfiguration.php(39): array_diff(Array, NULL, NULL)
#2 /opt/www/laravel-test/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(206): LaravelFly\Simple\Bootstrap\LoadConfiguration->bootstrap(Object(LaravelFly\Simple\Application))
#3 /opt/www/laravel-test/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(162): Illuminate\Foundation\Application->bootstrapWith(Array)
#4 /opt/www/laravel-test/vendor/scil/laravel-fly/src/LaravelFly/Server/HttpServer.php(59): Illuminate\Foundation\Http\Kernel->bootstrap()
#5 {main}
[INFO] event worker.ready for id 1
[INFO] event worker.ready for id 2
[ERROR] bootstrap: Whoops\Exception\ErrorException: array_diff(): Argument #2 is not an array in /opt/www/laravel-test/vendor/scil/laravel-fly/src/LaravelFly/Simple/Bootstrap/LoadConfiguration.php:39
Stack trace:
#0 [internal function]: Whoops\Run->handleError(2, 'array_diff(): A...', '/opt/www/larave...', 39, Array)
#1 /opt/www/laravel-test/vendor/scil/laravel-fly/src/LaravelFly/Simple/Bootstrap/LoadConfiguration.php(39): array_diff(Array, NULL, NULL)
#2 /opt/www/laravel-test/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(206): LaravelFly\Simple\Bootstrap\LoadConfiguration->bootstrap(Object(LaravelFly\Simple\Application))
#3 /opt/www/laravel-test/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(162): Illuminate\Foundation\Application->bootstrapWith(Array)
#4 /opt/www/laravel-test/vendor/scil/laravel-fly/src/LaravelFly/Server/HttpServer.php(59): Illuminate\Foundation\Http\Kernel->bootstrap()
#5 {main}
[INFO] event worker.ready for id 3
[2018-05-22 15:34:04 #24034.5] NOTICE Server is shutdown now.
[INFO] event worker.stopped for id 2
[INFO] event worker.stopped for id 1
[INFO] event worker.stopped for id 3
`[INFO] include: /project/bootstrap/cache/laravelfly_preload.php
Fatal error: Cannot declare class Monolog\Handler\AbstractHandler, because the name is already in use in /project/bootstrap/\cache/laravelfly_preload.php on line 16140`
y i run ab test bewteen fpm & laravelfly , fpm is faster
with opcaceh open, php7 zts
it will be even faster, when no opcache and php7 non zts
nginx + fpm + laravel
ab -c 4 -n 100 'http://laravelfly.dev/'
Requests per second: 51.34 [#/sec] (mean)
Time per request: 77.907 [ms] (mean)
Time per request: 19.477 [ms] (mean, across all concurrent requests)
Transfer rate: 100.36 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 8 9.4 6 50
Processing: 32 69 65.6 49 397
Waiting: 32 69 65.6 49 396
Total: 34 77 65.6 58 397
faster than
laravelfly
ab -c 4 -n 100 'http://127.0.0.1:9501/'
Requests per second: 12.17 [#/sec] (mean)
Time per request: 328.751 [ms] (mean)
Time per request: 82.188 [ms] (mean, across all concurrent requests)
Transfer rate: 23.55 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.6 0 6
Processing: 71 321 86.4 316 782
Waiting: 71 321 86.4 316 782
Total: 72 321 86.1 316 782
nginx:
server {
listen 80;
error_log /usr/local/nginx/logs/error.log;
charset utf-8;
root /Users/liufa/Documents/www/laravel_blog/public;
server_name www.laravel_blogfly.com;
# useful when debug
#504 Gateway timeout error http://stackoverflow.com/questions/18229757/nginx-php-fpm-xdebug-netbeans-can-start-only-one-debug-session
# for firefox, otherwise firefox may dowload some page; default file type is: octet-stream
include /usr/local/nginx/mime.types; default_type text/html;
location / {
# you can place index.html on document root dir
index index.php index.html;
try_files $uri $uri/ @other;
}
location = / {
proxy_http_version 1.1;
proxy_set_header Connection "keep-alive";
proxy_pass http://127.0.0.1:9501;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
}
location @other {
proxy_http_version 1.1;
proxy_set_header Connection "keep-alive";
proxy_pass http://127.0.0.1:9501;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
}
}
root@UNIT3D-DEMO:/var/www/html# composer require "scil/laravel-fly":"dev-master"
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for scil/laravel-fly dev-master -> satisfiable by scil/laravel-fly[dev-master].
- Conclusion: remove laravel/framework v6.6.0
- Conclusion: don't install laravel/framework v6.6.0
- scil/laravel-fly dev-master requires laravel/framework 5.5.* || 5.6.* || 5.7.* || 5.8.* || 6.0.* -> satisfiable by laravel/framework[5.5.x-dev, 5.6.x-dev, 5.7.x-dev, 5.8.x-dev, v6.0.0, v6.0.1, v6.0.2, v6.0.3, v6.0.4].
- Can only install one of: laravel/framework[5.8.x-dev, v6.6.0].
- Can only install one of: laravel/framework[v6.0.0, v6.6.0].
- Can only install one of: laravel/framework[v6.0.1, v6.6.0].
- Can only install one of: laravel/framework[v6.0.2, v6.6.0].
- Can only install one of: laravel/framework[v6.0.3, v6.6.0].
- Can only install one of: laravel/framework[v6.0.4, v6.6.0].
- Can only install one of: laravel/framework[5.5.x-dev, v6.6.0].
- Can only install one of: laravel/framework[5.6.x-dev, v6.6.0].
- Can only install one of: laravel/framework[5.7.x-dev, v6.6.0].
- Installation request for laravel/framework (locked at v6.6.0, required as ^6.0) -> satisfiable by laravel/framework[v6.6.0].
我们公司的项目是基于lumen框架的,直接使用swoole会造成数据污染,连接之间的数据会相互干扰。看了您的帖子谈到了这个问题。这个项目能直接移植到lumen下吗
do we have plan to add connection pooling feature?
[ERROR] bootstrap: Error: Call to undefined method Illuminate\Log\LogServiceProvider::coroutineFriendlyServices() in /Users/liupeng/Site/quding/vendor/scil/laravel-fly/src/LaravelFly/Map/Bootstrap/LoadConfiguration.php:56
Stack trace:
#0 /Users/liupeng/Site/quding/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(206): LaravelFly\Map\Bootstrap\LoadConfiguration->bootstrap(Object(LaravelFly\Simple\Application))
#1 /Users/liupeng/Site/quding/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(162): Illuminate\Foundation\Application->bootstrapWith(Array)
#2 /Users/liupeng/Site/quding/vendor/scil/laravel-fly/src/LaravelFly/Server/HttpServer.php(59): Illuminate\Foundation\Http\Kernel->bootstrap()
#3 {main}
'Http/Kernel.php' should now be just 'Kernel.php' ? since you moved the kernel a directory up before.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.