Comments (8)
Maybe you forgot to enable swoole extension in php.ini, use php --ri swoole
or php -m|grep swoole
to confirm whether swoole is enabled.
from php-sse.
Yeah, it is enabled. Both
/opt/plesk/php/8.0/bin/php -m | grep swoole
swoole
and
php -m | grep swoole
swoole
are showing the correct output but unfortunately I am still not able to use the extension in my php scripts. When using https://github.com/hhxsv5/php-sse/blob/master/examples/sse-swoole.php for testing purposes I am still getting an error
Class "Swoole\Http\Server" not found
.
Everything has been restarted multiple times so this shouldn't be an issue.
from php-sse.
Whether different versions of php are installed, try to run sse-swoole.php
with the php absolute path.
/opt/plesk/php/8.0/bin/php sse-swoole.php
And show me the output about /opt/plesk/php/8.0/bin/php --ri swoole
please.
Similar issue #3246
from php-sse.
Okay, so /opt/plesk/php/8.0/bin/php --ri swoole
outputs:
swoole
Swoole => enabled
Author => Swoole Team [email protected]
Version => 4.5.9
Built => Dec 23 2020 13:24:33
coroutine => enabled
epoll => enabled
eventfd => enabled
signalfd => enabled
cpu_affinity => enabled
spinlock => enabled
rwlock => enabled
sockets => enabled
openssl => OpenSSL 1.1.1g 21 Apr 2020
http2 => enabled
pcre => enabled
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
async_redis => enabled
Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => On => On
swoole.unixsock_buffer_size => 8388608 => 8388608
Directly running ssw-swoole.php leads to same error as described above.
Don't know if it is relevant in this context but I also asked the swoole maintainers at their GitHub page and they wrote it cannot be run in cli mode. But what's the point when execution by a user from a browser ist not possible? Your example looks like it is possible so I am a bit confused right now.
Link to the mentioned comment: swoole/swoole-src#3952 (comment)
from php-sse.
Yes, the Swoole example can only be run in cli mode, not in FPM.
php sse-swoole.php
Swoole has a built-in Http server, which is started in cli
mode, and you should directly access http://127.0.0.1:5200/ in browser. not http://127.0.0.1/sse-swoole.php.
from php-sse.
Yeah that finally makes sense and would maybe explain the described behavior. I am going to try it out today or the next days.
Thank you very much for your help
from php-sse.
Anytime.
from php-sse.
For another reason I cannot test it right now unfortunately. But as said before I really think the way you described works out.
Closing the issue now because the former question has been answered.
from php-sse.
Related Issues (20)
- Close the Connection. HOT 1
- How about the performance tuning? HOT 3
- Efficient way of checking & publishing new data HOT 1
- How to make it work in Swoole Server HOT 2
- Push events only when POST method kicks in HOT 4
- EventSource's response has a MIME type ("application/json") that is not "text/event-stream". Aborting the connection. HOT 1
- Get HTTP_LAST_EVENT_ID HOT 1
- Change the default event id set-up HOT 1
- StopSSEException() implementation HOT 1
- Not working -> all console.log()'s appear at once after 2 min. of pending
- SSE creates new connection
- Send Ping HOT 1
- Fatal Error: Maximum execution time of 120 seconds exceeded (in SSE.php:20) HOT 2
- SE Eventsource Asp.net Core 3.1
- How to implement this with database?
- Allow to set the retry value HOT 3
- How to send a message during a "real" process HOT 9
- Im confused about server side ?? HOT 1
- Interesting but not sure if it is what I want HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-sse.