You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

PHP7.2.x无openssl.so扩展问题求助

解决PHP 7.2 + Debian Jessie 8.6下openssl.so缺失的问题

Hey there, let's work through this OpenSSL extension issue step by step for your setup. The core problem here is that system-level OpenSSL and PHP's OpenSSL extension are separate components—you've got the former installed, but the latter is missing or misconfigured. Let's fix this:

1. 先确认PHP 7.2的软件源(关键前提)

Debian Jessie 8.6's default repos don't include PHP 7.2 (it only ships with PHP 5.6), so you must have used a third-party repo like Dotdeb to install PHP 7.2. First, make sure your repo config is correct:

  • Check files in /etc/apt/sources.list or /etc/apt/sources.list.d/ to confirm you have a valid PHP 7.2 repo for Jessie. For example, Dotdeb's repo lines should look like:
    deb http://packages.dotdeb.org jessie all
    deb-src http://packages.dotdeb.org jessie all
    
  • If you haven't added the repo's GPG key yet, run:
    wget https://www.dotdeb.org/dotdeb.gpg
    apt-key add dotdeb.gpg
    
  • Update your repo cache: apt-get update

2. 安装PHP 7.2专属的OpenSSL扩展

PHP's OpenSSL extension is a standalone package—system OpenSSL won't cover this. Install it with:

apt-get install php7.2-openssl

This command will automatically place openssl.so in the correct extension directory (/usr/lib/php/20170718/ as you checked) and configure your php.ini file, so you won't need to manually add the extension line (though leaving it in won't hurt if the path is correct).

3. 验证扩展是否生效

  • For the CLI environment: Run php -m | grep openssl—if you see openssl printed, the CLI side is working.
  • For Apache's PHP environment: Create a file named info.php in your web root (e.g., /var/www/html/info.php) with this content:
    <?php phpinfo(); ?>
    
    Access this file via your browser, then search for "openssl". If you see a dedicated configuration block for OpenSSL, the Apache side is loading the extension correctly.

4. Double-check the extension_dir path in php.ini

Sometimes an incorrect extension_dir setting can prevent PHP from finding the extension. Open /etc/php/7.2/apache2/php.ini and ensure this line is uncommented and points to the right directory:

extension_dir = "/usr/lib/php/20170718/"

Make sure the path matches exactly what you saw with your ls command.

5. Confirm Apache is using PHP 7.2

Verify that Apache has the PHP 7.2 module enabled:

a2query -m php7.2

If it returns php7.2 (enabled), you're good. If not, enable it with a2enmod php7.2 then restart Apache.

6. Check Apache error logs for clues

If you're still stuck, look at Apache's error log (/var/log/apache2/error.log)—it will have specific details about why the extension isn't loading, like path mismatches or permission issues. Use those logs to narrow down the problem.


内容的提问来源于stack exchange,提问作者zewOlF

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 09:42:51