dongyu5104 2014-04-09 09:58
浏览 62

如何通过httpd.conf在Apache2上激活PHP

I have Windows 7 Utimate System.
I have a working Apache2 server without PHP activated.
I have downloaded PHP5 and extracted the files to C:\php. I added these lines to activate PHP to httpd.conf file, as per instructions in PHP directory:

    ##PHP
    # For PHP 5 do something like this:
    LoadModule php5_module "C:/php/php5apache2_4.dll"
    AddType application/x-httpd-php .php

    # configure the path to php.ini
    PHPIniDir "C:/php"
    ####################PHP  

Now Apache refusing to start again, even after restarting the system.
It is starting fine if I undo changes to conf.
How to get PHP and server working?

error.log for Apache says:

"[Fri Apr 11 10:57:43 2014] [warn] pid file C:/Program Files (x86)/  
Apache Group/Apache2/logs/httpd.pid overwritten -- Unclean shutdown  
of previous Apache run?" 
  • 写回答

1条回答 默认 最新

  • douchun1859 2014-04-11 06:28
    关注

    The warning error log was irrelevant. It merely says the httpd.pid is overwritten and the server should be online anyway.

    Apache & PHP on Windows requires both to be compiled in the same environment for compatibility especially when you download pre-compiled binaries for Apache and PHP, you have to make sure they are being compiled using the same compiler.

    Eg.

    OK

    Apache 2.4.9 Win32 VC11 & PHP 5.5.11 VC11 x86

    Apache 2.4.9 Win32 VC9 & PHP 5.5.11 VC9 x86

    Apache 2.2.27 Win32 VC9 & PHP 5.4.27 VC9 x86

    NOT OK

    Apache 2.4.9 Win32 VC11 & PHP 5.4.27 VC9 x86

    Apache 2.4.9 Win32 VC9 & PHP 5.5.11 VC11 x86

    Apache 2.2.27 Win32 VC9 & PHP 5.5.11 VC11 x86

    Try making sure PHP you downloaded is built with the same compiler ie. VC11 coupled with VC11 or VC9 coupled with VC9 as well as x86 with x86 and x64 with x64.

    This might not be always the case but when I follow this, it'll work.

    评论

报告相同问题?

悬赏问题

  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c