Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Error: Undefined constant OpenSwoole\Constant::SSL #48

Open
ghnp5 opened this issue Jun 26, 2023 · 3 comments
Open

Uncaught Error: Undefined constant OpenSwoole\Constant::SSL #48

ghnp5 opened this issue Jun 26, 2023 · 3 comments

Comments

@ghnp5
Copy link

ghnp5 commented Jun 26, 2023

In the documentation: https://openswoole.com/docs/modules/swoole-server-construct

To enable SSL: $sock_type | OpenSwoole\Constant::SSL. Check configuration for SSL

So I have:

$server = new Server('*', 9000, \OpenSwoole\Server::POOL_MODE, \OpenSwoole\Constant::SOCK_TCP | \OpenSwoole\Constant::SSL);

However, I get this error:

Uncaught Error: Undefined constant OpenSwoole\Constant::SSL

OpenSwoole v22

I installed openswoole with pecl install openswoole

@ghnp5
Copy link
Author

ghnp5 commented Jun 26, 2023

And if I try to hardcode the bitwise OR result (1 | 512 = 513), I get this:

Uncaught OpenSwoole\Exception: failed to listen server port[*:9000], Error: Socket type not supported[94]

@mertingen
Copy link

mertingen commented Jun 30, 2023

Hi @ghnp5 ,

Those are supported constants. Maybe docs are outdated, I'm not sure.

OpenSwoole\Constant::SSLv3_METHOD
OpenSwoole\Constant::SSLv3_SERVER_METHOD
OpenSwoole\Constant::SSLv3_CLIENT_METHOD
OpenSwoole\Constant::SSLv23_METHOD
OpenSwoole\Constant::SSLv23_SERVER_METHOD
OpenSwoole\Constant::SSLv23_CLIENT_METHOD

The default algorithm is OpenSwoole\Constant::SSLv23_METHOD.

https://openswoole.com/docs/modules/swoole-server/configuration

@ghnp5
Copy link
Author

ghnp5 commented Jul 2, 2023

Hello,

Thank you for your reply.

Seems you're referring to this line:

'ssl_method' => OpenSwoole\Constant::SSLv3_CLIENT_METHOD, // removed from v4.5.4

which was removed in v4.5.4.

--

What I'm referring to is this: https://openswoole.com/docs/modules/swoole-server-construct

Where it says:

To enable SSL: $sock_type | OpenSwoole\Constant::SSL. Check configuration for SSL

However, when I attempt to add that part, | OpenSwoole\Constant::SSL, I get the crashes described in my messages above.

Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants