php 无法加载 php5apache2_2.dll

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8263297/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 04:18:08  来源:igfitidea点击:

cannot load php5apache2_2.dll

phpapache

提问by Harry

cannot load c:/PHP5/php5apache2_2.dll into server I am getting this error while running apache 2.2 on window XP machine

无法将 c:/PHP5/php5apache2_2.dll 加载到服务器中 我在 Windows XP 机器上运行 apache 2.2 时遇到此错误

anyone have any idea what could be the problem. I can see there is no php5apache2_2.dll in c:/php5 folder.

任何人都知道可能是什么问题。我可以看到 c:/php5 文件夹中没有 php5apache2_2.dll。

采纳答案by sandino

First you must downlaod de .dll file (php5apache2_2.dll) then put it in your extensions directory.

首先,您必须下载 .dll 文件(php5apache2_2.dll),然后将其放入您的扩展目录中。

Then edit your php.ini file, find de text:

然后编辑你的 php.ini 文件,找到 de text:

;extension=php5apache2_2.dll

;扩展名=php5apache2_2.dll

// and change y to extension=php5apache2_2.dll

// 并将 y 更改为 extension=php5apache2_2.dll

if the text is not present put the line yourself. Then restart apache and it should load your extension.

如果文本不存在,请自行放置该行。然后重新启动 apache,它应该加载您的扩展。

PD: you can see where your extensions directory is located looking for the text "extension_dir" in your php.ini, sometimes looks like: extension_dir = C:\php\extensions

PD:你可以看到你的扩展目录所在的位置,在你的 php.ini 中寻找文本“extension_dir”,有时看起来像:extension_dir = C:\php\extensions

Hope this help you, if not please paste the error here, you can find an error log file in apache/error/error.log or something like that.

希望这对您有所帮助,如果没有请在此处粘贴错误,您可以在 apache/error/error.log 或类似内容中找到错误日志文件。

回答by Nact

What worked for me was obtaining php5apache2_4.dll-php-5.4-win32.zip from apacheloungeand using "php5apache2_4.dll" file from the "PHP 5.4.8" unzipped folder. I had apache 2.3.4 (32-bit) from apachelounge.com and php 5.4.9 (32-bit) from windows.php.net installed on my Win 7 (64-bit).

对我有用的是从apachelounge获取php5apache2_4.dll-php-5.4-win32.zip 并使用“PHP 5.4.8”解压缩文件夹中的“php5apache2_4.dll”文件。我在我的 Win 7(64 位)上安装了来自 apachelounge.com 的 apache 2.3.4(32 位)和来自 windows.php.net 的 php 5.4.9(32 位)。

The dll worked despite 5.4.8 - 5.4.9 mismatch.

尽管 5.4.8 - 5.4.9 不匹配,dll 仍然有效。

The corrsponding changes within "php.ini" and "httpd.conf" are to be maintained acoording to this helpful guide.

“php.ini”和“httpd.conf”中的相应更改将根据此有用指南进行维护

Best regards.

此致。

回答by Nirolivier Razafindrabekoto

You should download the dllfile from PHP distribution package. And see three ways to set up PHP to work with Apache 2.x.

您应该dllPHP 分发包下载该文件。并查看设置 PHP 以与 Apache 2.x 一起使用的三种方法

You can configure PHP as Apache handler in <[apache_home]>\conf\httpd.conf as follow:

您可以在 <[apache_home]>\conf\httpd.conf 中将 PHP 配置为 Apache 处理程序,如下所示:

LoadModule php5_module "c:/php/php5apache2_2.dll"
AddHandler application/x-httpd-php .php
#configure the path to php.ini
PHPIniDir 'C:\php\'

NOTE:To avoid the error while starting apache, the php ini dirpath should be in single quotes with backslash. Don't forget to end it with backslash.

注意:为了避免在启动 apache 时出现错误,php ini dir路径应该用单引号加上反斜杠。不要忘记以反斜杠结尾。

回答by Rob

Here is how I got it to GO:

这是我如何让它去:

  1. Created the folder C:\Apache
  2. Downloaded and installed http-2.2.22-win32-x86-no-ssl.msi During install, entered localhostas Network Domain and Server Name
  3. From browser, typed in url http://localhost/and page came up with "It Works" (I do not know if there is a God, but took that as a good sign:)

  4. Created the folder C:\PHP

  5. Downloaded and installed php-5.2.17-Win32-VC6-86.msi
  6. Created a new file in notepad with the following:
  7. Saved it in the Apache/htdocs folder as phpinfo.php
  8. From browser, typed in url http://127.0.0.1/phpinfo.php
    It did not work (i.e. it did not run the .php program file)

  9. Hmm, oh yeah, you have to restart Apache for it to see updates to its own configuration file
    Start, Apache, Control..
    -> generated the error that it could not find C:\Apache\php5apache2_2.dll

  10. Well, I found it in C:\PHP and I copied it to C:\Apache\
    Start, Apache, Control..
    -> generated an error about a problem with the PHPINIDir directive on line 495 of C:/Apache/conf/httpd.conf

  11. Fixed that by editing this line in the above file to

    PHPIniDir "C:/PHP/php.ini"
    
  12. Tried to restart Apache again, run the test file in the browser. Still, it did not work:(

  13. Recalled seeing this before and decided to reboot computer Restarted (or started) the Apache Server

  14. Ran the test file again.. IT WORKED!

  1. 创建文件夹 C:\Apache
  2. 下载并安装 http-2.2.22-win32-x86-no-ssl.msi 在安装过程中,输入localhost为网络域和服务器名称
  3. 从浏览器中,输入 urlhttp://localhost/和页面想出了“It Works”(我不知道是否有上帝,但认为这是一个好兆头:)

  4. 创建文件夹 C:\PHP

  5. 下载安装php-5.2.17-Win32-VC6-86.msi
  6. 在记事本中创建了一个新文件,内容如下:
  7. 将其作为 phpinfo.php 保存在 Apache/htdocs 文件夹中
  8. 从浏览器中,输入 urlhttp://127.0.0.1/phpinfo.php
    它不起作用(即它没有运行 .php 程序文件)

  9. 嗯,哦是的,你必须重新启动 Apache 才能看到它自己的配置文件的更新
    Start, Apache, Control..
    -> 生成了找不到 C:\Apache\php5apache2_2.dll 的错误

  10. 好吧,我在 C:\PHP 中找到了它,并将其复制到 C:\Apache\
    Start, Apache, Control..
    -> 在 C:/Apache/conf/ 的第 495 行生成了有关 PHPINIDir 指令问题的错误配置文件

  11. 通过编辑上述文件中的这一行来修复该问题

    PHPIniDir "C:/PHP/php.ini"
    
  12. 再次尝试重新启动Apache,在浏览器中运行测试文件。尽管如此,它还是没有用:(

  13. 回忆起之前看到这个并决定重新启动计算机重新启动(或启动)Apache 服务器

  14. 再次运行测试文件.. 成功了!

Note that in some of the above I may have mixed up some forward and back slashes Good luck!

请注意,在上面的某些内容中,我可能混淆了一些正斜杠和反斜杠 祝你好运!

回答by Darkane

You are getting an error due to the fact that the c:/PHP5/php5apache2_2.dll is not shipped with the non-thread safe version of PHP that you probably downloaded. Two options:

由于 c:/PHP5/php5apache2_2.dll 未随您可能下载的 PHP 的非线程安全版本一起提供,因此您收到错误消息。两种选择:

  • Download and install the thread safe version of PHP instead and you will get everything you need.

  • If the non-thread safe version is important to what you want to accomplish, download the zip bundle of the thread safe version and take only the .dll you need from there.

  • 下载并安装 PHP 的线程安全版本,您将获得所需的一切。

  • 如果非线程安全版本对您要完成的任务很重要,请下载线程安全版本的 zip 包并从那里只获取您需要的 .dll。

Which version: For Apache Server 2.2, you need to download PHP 5.4 thread safe, which is shipped with both php5apache2_2.dll and php5apache2_4.dll. Some earlier versions probably work as well. PHP 5.5 is only shipped with php5apache2_4.dll which will mismatch with your version.

哪个版本:对于 Apache Server 2.2,您需要下载 PHP 5.4 线程安全,它与 php5apache2_2.dll 和 php5apache2_4.dll 一起提供。一些早期版本可能也能工作。PHP 5.5 仅随 php5apache2_4.dll 一起提供,这将与您的版本不匹配。

Cf the download links here on the official site: http://windows.php.net/download/.

参考官方网站上的下载链接:http: //windows.php.net/download/

回答by Reedyseth

For me the problem was resolved by replacing the file php5apache2_2.dll from another site, somehow the file downloaded from the php.net site was corrupt.

对我来说,问题是通过从另一个站点替换文件 php5apache2_2.dll 来解决的,不知何故从 php.net 站点下载的文件已损坏。

I had already the file php5apache2_2.dll on my wamp 2.2 and the PHP version 5.3.13 so I just copied that file into my version 5.4.35 and it worked.

我的 wamp 2.2 和 PHP 版本 5.3.13 上已经有了 php5apache2_2.dll 文件,所以我只是将该文件复制到我的 5.4.35 版本中并且它工作正常。

I did not have to mess with the apache configuration as other people suggest.

我不必像其他人建议的那样弄乱 apache 配置。

One more thing I did was to install the Visual C++ Redistributable for Visual Studio 2008 for my x64 machine running Windows 7 Ultimate Edition. I don't think this helped since I had already the x86 version and working with my previous PHP version, but is part of the action I taken.

我做的另一件事是为运行 Windows 7 Ultimate Edition 的 x64 机器安装 Visual C++ Redistributable for Visual Studio 2008。我认为这没有帮助,因为我已经有了 x86 版本并使用了我以前的 PHP 版本,但这是我采取的行动的一部分。

回答by adh

Please check that for using Apache you should download VC6 version of PHP. If you use VC9 Apache will not start. It is clearly given in the site.

请检查是否要使用 Apache,您应该下载 VC6 版本的 PHP。如果使用VC9 Apache 将无法启动。网站上已经明确给出了。

http://in3.php.net/manual/en/install.windows.manual.php

http://in3.php.net/manual/en/install.windows.manual.php

回答by pleiovn

None of the suggestions above worked for me. I tried replacing the php5apache2_2.dll file and restarting everything, but got the same error. I ended up uninstalling Apache, MySQL, and PHP, removing the path variables, and then installing WampServer. Had everything up and running in less than 5 minutes.

以上建议都不适合我。我尝试替换 php5apache2_2.dll 文件并重新启动所有内容,但遇到了同样的错误。我最终卸载了 Apache、MySQL 和 PHP,删除了路径变量,然后安装了 WampServer。在不到 5 分钟的时间内完成了所有工作。

By the way, I uninstalled PHP by just deleting the folder in Program Files, since it did not turn up in Add/Remove Programs. I also deleted any leftover Apache and MySQL folders after the uninstalls.

顺便说一下,我只是通过删除 Program Files 中的文件夹来卸载 PHP,因为它没有出现在 Add/Remove Programs 中。卸载后,我还删除了所有剩余的 Apache 和 MySQL 文件夹。

回答by across

Even file exist and apache shows error that this file don't exists, install Microsoft C++ Redistributable Package. Note, that you have to install 2008 version, then 2010. Install both packages, not only 2010 version.

即使文件存在并且 apache 显示此文件不存在的错误,请安装 Microsoft C++ Redistributable Package。请注意,您必须安装 2008 版本,然后是 2010。安装两个包,而不仅仅是 2010 版本。

回答by Ross T.

I've had a similar problem. I found out after following a particular Youtube tutorial that if you go and edit the httpd.conf file while Apache is running... it will mess up. Make sure that you install Apache first... then turn it off, then install php afterward. It should then edit the httpd.conf file itself. This Youtube tutorial solved my problem. http://www.youtube.com/watch?v=UKbEzmMliNMHope it helps. I got MySQL installed and working too... but had to install the .Net 4 Framework.

我遇到了类似的问题。我在遵循特定的 Youtube 教程后发现,如果你在 Apache 运行时编辑 httpd.conf 文件......它会搞砸。确保你先安装Apache...然后将其关闭,然后再安装php。然后它应该编辑 httpd.conf 文件本身。这个 Youtube 教程解决了我的问题。 http://www.youtube.com/watch?v=UKbEzmMliNM希望有帮助。我安装了 MySQL 并且也可以工作......但必须安装 .Net 4 Framework。