AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1015819
Accepted
undo
undo
Asked: 2020-05-06 10:57:56 +0800 CST2020-05-06 10:57:56 +0800 CST 2020-05-06 10:57:56 +0800 CST

PHP 在通过 CLI 调用时加载扩展,而不是通过 Apache

  • 772

对我来说,PHP 仅在从 CLI 调用时才能完美加载扩展,但在我通过 Apache 加载页面时却不能。

例如,这是 的输出php -m:

[PHP Modules]
bcmath
calendar
Core
ctype
curl
date
dom
filter
hash
iconv
json
libxml
mysqlnd
openssl
pcre
PDO
Phar
readline
Reflection
session
SimpleXML
SPL
standard
tokenizer
xml
xmlreader
xmlwriter
zip
zlib

但是,当通过 Apache 运行时:
1. 在phpinfo()中,OpenSSL 支持显示为“已禁用”。
2.extension_loaded("curl")是false
3.get_loaded_extensions()不包括curlor OpenSSL。
4. 尝试使用任何扩展功能失败。

这是var_dump(get_loaded_extensions());通过 Apache 运行时:

array(28) {
  [0]=>
  string(4) "Core"
  [1]=>
  string(6) "bcmath"
  [2]=>
  string(8) "calendar"
  [3]=>
  string(5) "ctype"
  [4]=>
  string(4) "date"
  [5]=>
  string(6) "filter"
  [6]=>
  string(4) "hash"
  [7]=>
  string(5) "iconv"
  [8]=>
  string(4) "json"
  [9]=>
  string(3) "SPL"
  [10]=>
  string(4) "pcre"
  [11]=>
  string(8) "readline"
  [12]=>
  string(10) "Reflection"
  [13]=>
  string(7) "session"
  [14]=>
  string(8) "standard"
  [15]=>
  string(7) "mysqlnd"
  [16]=>
  string(9) "tokenizer"
  [17]=>
  string(3) "zip"
  [18]=>
  string(4) "zlib"
  [19]=>
  string(6) "libxml"
  [20]=>
  string(3) "dom"
  [21]=>
  string(3) "PDO"
  [22]=>
  string(4) "Phar"
  [23]=>
  string(9) "SimpleXML"
  [24]=>
  string(3) "xml"
  [25]=>
  string(9) "xmlreader"
  [26]=>
  string(9) "xmlwriter"
  [27]=>
  string(14) "apache2handler"
}

操作系统:Windows 10 1809, up to date.

php -v:

PHP 7.4.5 (cli) (built: Apr 14 2020 16:17:34) ( ZTS Visual C++ 2017 x64 )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

httpd:来自https://www.apachelounge.com/的 Apache 2.4.43 Win64

PHP 和 Apache 通过 this in httpd.conf(mod_php) 进行交互:

LoadModule php7_module "C:/<path_to_PHP>/PHP7/php7apache2_4.dll"

这台机器上只安装了一个 Apache+PHP。


我试过的:

  1. 确认 PHP 在两种模式下都使用相同的 ini 文件。如果我从 ini 文件中禁用扩展名,它们就会停止显示php -m(应该如此)。
  2. (重新)安装 MS Visual Studio C++ Redistributable 2015-19(x86 和 x64)。
  3. 重新启动httpd。
  4. 重启电脑。
  5. 重新安装 PHP 和 Apache。
  6. display_startup_errors=on然后检查日志。Apache 和 PHP 错误日志中都没有相关信息。
  7. 确认 PHP 正在 ZTS 中运行php.exe -v,“线程安全”显示为phpinfo()通过 Apache 启用。

请帮忙。我需要这个网络服务器启动并运行,这让我发疯。

windows php extension apache-2.4
  • 1 1 个回答
  • 660 Views

1 个回答

  • Voted
  1. Best Answer
    undo
    2020-05-24T09:50:51+08:002020-05-24T09:50:51+08:00

    我能够通过将 Apache Lounge 二进制文件替换为Apache Haus的二进制文件来解决这个问题。

    我只是用Apache24新文件夹替换了旧文件夹,但保留了旧conf文件夹。无需进行其他更改。

    • 0

相关问题

  • 知道任何适用于 Windows 的快速可编写脚本的 ftp 客户端吗?[关闭]

  • 如果 Windows 服务崩溃,如何自动重新启动它?

  • 无法安排任务(访问被拒绝)

  • 物理机重启时自动重启虚拟机(VMWare)

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve