zoukankan      html  css  js  c++  java
  • Mac 自带 apache

    1.启动服务器

    sudo apachectl start

    http://localhost   能访问就ok

    sudo apachectl stop

    sudo apachectl restart

    httpd -v

    2.配置 php

    sudo open /etc/apache2/httpd.conf

    LoadModule php5_module libexec/apache2/libphp5.so  找到这行去掉前面的 #

    如果需要设置局域网访问,则修改httpd.conf中的以下内容:

    <Directory />
    AllowOverride none
    #Require all denied 用#把这个注释掉
    Require all granted 添加这一行代码
    </Directory>

     

    sudo cp /Library/WebServer/Documents/index.html.en /Library/WebServer/Documents/info.php 即在Apache的根目录下复制index.html.en文件并重命名为info.php

    在httpd.conf中找到DocumentRoot,此目录即为工作目录,一般默认为:/Library/WebServer/Documents/

    打开finder shift+command+G  /etc/apache2/直达

    打开info.php,在It works后面加上<?php phpinfo(); ?>,然后再次重启Apache

    3.

    在浏览器中输入http://localhost/info.php,会出现一个显示php信息的页面

  • 相关阅读:
    第十一周课程总结
    第十周课程总结
    第九周课程总结&实验报告
    第八周课程总结&实验报告
    第七周课程总结&实验报告
    第六周课程总结&实验报告
    课程总结
    第十四周
    第十三周
    第十二周
  • 原文地址:https://www.cnblogs.com/ficow/p/5112071.html
Copyright © 2011-2022 走看看