php 安装 openssl
时间: 2023-09-10 16:13:07 浏览: 181
要在 PHP 中启用 OpenSSL 扩展,需要在安装 PHP 时包含 OpenSSL 依赖项并启用 OpenSSL 扩展。如果您的 PHP 安装中未包含 OpenSSL,您需要按照以下步骤安装 OpenSSL。
在 Ubuntu 系统上,可以使用以下命令安装 OpenSSL:
```
sudo apt-get update
sudo apt-get install openssl
```
在 CentOS 系统上,可以使用以下命令安装 OpenSSL:
```
sudo yum install openssl openssl-devel
```
安装 OpenSSL 后,需要重新编译 PHP 才能启用 OpenSSL 扩展。您可以按照以下步骤编译 PHP:
1. 下载 PHP 源代码:
```
wget https://www.php.net/distributions/php-x.y.z.tar.gz
```
其中,x.y.z 是 PHP 的版本号。
2. 解压缩 PHP 源代码:
```
tar -zxvf php-x.y.z.tar.gz
```
3. 进入 PHP 源代码目录,并运行以下命令:
```
./configure --with-openssl
make
sudo make install
```
这将编译并安装启用了 OpenSSL 扩展的 PHP。您可以通过运行以下命令检查 PHP 是否启用了 OpenSSL 扩展:
```
php -m | grep openssl
```
如果输出 openssl,则表示已成功启用 OpenSSL 扩展。
阅读全文
相关推荐


















