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

openssl 证书路径 #88

Open
matyhtf opened this issue Mar 22, 2023 · 3 comments
Open

openssl 证书路径 #88

matyhtf opened this issue Mar 22, 2023 · 3 comments

Comments

@matyhtf
Copy link
Member

matyhtf commented Mar 22, 2023

macOS 下会指向 ~/.swoole_cli/openssl/ssl ,linux 会指向 /usr/openssl/ssl

用户需要创建软连接,可在编译 openssl 时指定证书路径,直接使用操作系统的证书

@jingjingxyk
Copy link
Contributor

jingjingxyk commented Mar 23, 2023

除了上述办法以外,还可以使用如下几种方式

创建证书

mkdir -p /etc/ssl/

wget https://curl.se/ca/cacert.pem  -O /etc/ssl/cacert.pem

指定证书方式一:

./swoole-cli  -d 'curl.cainfo="/etc/ssl/cacert.pem"' -d 'openssl.cafile="/etc/ssl/cacert.pem"'  your_application.php

指定证书方式二:

# 生成 php 配置文件
cat > /etc/my_custom.ini <<EOF
curl.cainfo="/etc/ssl/cacert.pem"
openssl.cafile="/etc/ssl/cacert.pem"
EOF

./swoole-cli  -c /etc/my_custom.ini  your_application.php

指定证书方式三:

$ca='/root/cacert.pem';
curl_setopt($ch, CURLOPT_CAINFO, $ca);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);

@jingjingxyk
Copy link
Contributor

jingjingxyk commented May 26, 2023

还可以在编译 swoole-cli 时添加这个参数: 运行环境创建这个目录,并在 /usr/local/swoole-cli/etc/ 创建 php.ini 文件

--with-config-file-path=/usr/local/swoole-cli/etc/ 

@jingjingxyk
Copy link
Contributor

还可以这样

export PHP_INI_SCAN_DIR=/usr/local/swoole-cli/etc/

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