[英]OpenSSL Support disabled in Apache 2.4/PHP 7.4.4
I'm trying to setup Apache MariaDB PHP manually but I'm running into some issues with the openssl feature.我正在尝试手动设置 Apache MariaDB PHP 但我遇到了 Z50935Z5D4B201A6761 功能的一些问题。 Here are the steps I took to setup Apache 2.4 and PHP 7.4.4:
以下是我设置 Apache 2.4 和 PHP 7.4.4 的步骤:
I. Apache httpd Installation and configuration一、Apache httpd安装配置
ServerRoot
in httpd.conf with full pathServerRoot
ServerName
to localhost:80
ServerName
设置为localhost:80
WWWROOT
with desired DocumentRoot path in httpd.conf (ie Define WWWROOT "E:/Programs/WWW"
)WWWROOT
Define WWWROOT "E:/Programs/WWW"
)DocumentRoot
and <Directory>
values to "${WWWROOT}"
DocumentRoot
和<Directory>
值设置为"${WWWROOT}"
II.二、 Combining PHP with apache
结合 PHP 与 apache
Define PHPROOT "D:/Programs-64Bit/PHP/PHP7.4.4-64Bit" LoadModule php7_module "${PHPROOT}/php7apache2_4.dll" AddType application/x-httpd-php.php PHPIniDir "${PHPROOT}" LoadFile "${PHPROOT}/libcrypto-1_1-x64.dll" LoadFile "${PHPROOT}/libssl-1_1-x64.dll" LoadFile "${PHPROOT}/libssh2.dll" LoadFile "${PHPROOT}/nghttp2.dll" LoadFile "${PHPROOT}/php7ts.dll"
III.三、 Testing PHP with Apache
使用 Apache 测试 PHP
<?php phpinfo(); ?>
This is what it tells me about openssl:这就是它告诉我关于 openssl 的信息:
according to " OpenSSL support disabled in Apache/PHP on Windows " on StackOverflow and the last comment in the php.net page " PHP Manual > Function Reference > Cryptography Extensions > OpenSSL > Installing/Configuring " it should be working. according to " OpenSSL support disabled in Apache/PHP on Windows " on StackOverflow and the last comment in the php.net page " PHP Manual > Function Reference > Cryptography Extensions > OpenSSL > Installing/Configuring " it should be working. what am I doing wrong?
我究竟做错了什么?
If you'd like to enable OpenSSL suport in Phar .如果您想在Phar中启用OpenSSL支持。
Just uncomment following line.只需取消注释以下行。
// php.ini
extension=openssl
This is actually easy to solve.这其实很容易解决。 after checking if openssl was enable on PHP in a command prompt with the command
php index.php
where index.php is the file created in the original post. after checking if openssl was enable on PHP in a command prompt with the command
php index.php
where index.php is the file created in the original post. One can see that openssl is actually enable.可以看到 openssl 实际上是启用的。
To enable it on Apache2.4, one needs to uncomment LoadModule ssl_module modules/mod_ssl.so
in httpd.conf.要在 Apache2.4 上启用它,需要在 httpd.conf 中取消注释
LoadModule ssl_module modules/mod_ssl.so
。
The phar section will look like this: phar 部分将如下所示:
And an openssl section will appear:并且将出现 openssl 部分:
In case anyone's extension=openssl
and LoadModule ssl_module modules/mod_ssl.so
are both uncommented and still looking for answers, try setting your extension_dir
to absolute path;如果任何人的
extension=openssl
和LoadModule ssl_module modules/mod_ssl.so
注释并且仍在寻找答案,请尝试将您的extension_dir
设置为绝对路径; extension_dir = "C:\php\ext"
. extension_dir = "C:\php\ext"
。
I've been searching around for hours and that solved it.我一直在寻找几个小时,这解决了它。 Thanks to Koichi's answer .
感谢Koichi的回答。 Also I didn't need any of those
LoadFile
lines my httpd.conf
.我的
httpd.conf
也不需要任何这些LoadFile
行。
My environment (for any reference):我的环境(供任何参考):
I spent a long time on this problem too and tried the suggested methods (uncommenting line, absolute not relative path).我也在这个问题上花了很长时间,并尝试了建议的方法(取消注释行,绝对不是相对路径)。 What finally worked was installing PHP into "C:\php" and updating the PHP module settings in Apache's httpd.conf, rather than having it in some other path.
最终奏效的是将 PHP 安装到“C:\php”并更新 Apache 的 httpd.conf 中的 PHP 模块设置,而不是将其放在其他路径中。 It feels like there's an Apache problem somewhere, as it working perfectly fine when PHP was installed in my initial non-standard path and served by another web server.
感觉好像在某处存在 Apache 问题,因为当 PHP 安装在我的初始非标准路径中并由另一个 web 服务器提供服务时,它工作得非常好。
If you have PHP installed somewhere else and are able to move it to C:\php and adjust Apache's settings, it's worth trying.如果您在其他地方安装了 PHP 并且能够将其移动到 C:\php 并调整 Apache 的设置,那么值得一试。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.