dongrui6787 2017-01-01 15:39
浏览 44

Apache版本冲突

I would like to set up Apache and PHP, but I think that, I have two versions of Apache, which is causing a conflict.

(I couldn't find a topic with the same problem, so If you have solved this problem before, please let me know the links. thanks)

I have OS X and If I run $ httpd -v I have Server version: Apache/2.4.23 (Unix) and for PHP $ php -v I got PHP 7.0.12

If I test in my browser just localhost it displayed "it works!

If I open the file sudo nano /etc/apache2/httpd.conf and activate (uncomment) the php module, I have this LoadModule php5_module libexec/apache2/libphp5.so (I uncommented the line)

Shouldn't be php7?

Additionally, If I open the file index.html located in cd /Library/WebServer/Documents and add the lines

<html>
<body>
<h1>It works!</h1>
<?php
$x = "Hello world!";
$y = 'Hello world!';

echo $x;
echo "<br>";
echo $y;
?>
</body>
</html>

and test again localhost in my browser, it only displays It works!

But If I select manually and open the file index.html under /Library/WebServer/Documents I got this:

It works!
"; echo $y; ?> 

In this case PHP is not activated.

Could you please tell me, how to work with the right Apache 2.4 with PHP (version 7)

P.D. I know that another alternative is to use MAMP, but I would like to fix this issue becuase I wouldn't like to have other conflicts due to it

Thank you in advance!

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
    • ¥15 正弦信号发生器串并联电路电阻无法保持同步怎么办
    • ¥15 划分vlan后,链路不通了?
    • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
    • ¥15 个人网站被恶意大量访问,怎么办
    • ¥15 Vue3 大型图片数据拖动排序
    • ¥15 Centos / PETGEM
    • ¥15 划分vlan后不通了
    • ¥20 用雷电模拟器安装百达屋apk一直闪退
    • ¥15 算能科技20240506咨询(拒绝大模型回答)