Coder Social home page Coder Social logo

Swoole Demo outdated? about php-sse HOT 8 CLOSED

hhxsv5 avatar hhxsv5 commented on August 25, 2024
Swoole Demo outdated?

from php-sse.

Comments (8)

hhxsv5 avatar hhxsv5 commented on August 25, 2024

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.

FelixMittermeier avatar FelixMittermeier commented on August 25, 2024

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.

hhxsv5 avatar hhxsv5 commented on August 25, 2024

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.

FelixMittermeier avatar FelixMittermeier commented on August 25, 2024

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.

hhxsv5 avatar hhxsv5 commented on August 25, 2024

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.

FelixMittermeier avatar FelixMittermeier commented on August 25, 2024

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.

hhxsv5 avatar hhxsv5 commented on August 25, 2024

Anytime.

from php-sse.

FelixMittermeier avatar FelixMittermeier commented on August 25, 2024

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)

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.