zoukankan      html  css  js  c++  java
  • mac攻略(二) -- 简单配置php开发环境

    最简单直接的方式还是使用 Mac 上自带的 Apache 和 PHP。
     
    1.启动 Apache
    1>启动apache $sudo apachectl start;
    2>启动后,在浏览器中输入 localhost ,可以看到页面上显示 It works。(/Library/WebServer/Documents/ 下的 index.html.en 文件)
    3>Apache 的默认根目录是 /Library/WebServer/Documents/
     
    2.添加apache对php的支持
    1>打开 http.conf 配置文件:
    sudo vim /etc/apache2/httpd.conf
    2>找到以下代码并去掉注释(去掉前面的‘#’号), wq 保存退出。 LoadModule php5_module libexec/apache2/ libphp5.so
     
    3.重启 Apache,进行php类型文件的调试
    重启: sudo apachectl restart
    在 Apache 的根目录 /Library/WebServer/Documents/ 下新建project文件夹并写一个php文件输出'hello world'。此时,在浏览器打开 http://localhost/project/test.php 就可以正常看到hello world 了~(如果有权限问题, sudo chown yourname:staff project 其中yourname是你自己的名字)
     
    4.使用homebrew安装mysql
    安装homebrew
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    安装mysql
    brew install mysql
    启动mysql
    mysql.server start
     
     
     
    Apache 常用命令
    //启动 Apache 服务
    sudo apachectl start
    // 重新启动 Apache 服务
    sudo apachectl restart
    // 关闭 Apache 服务
    sudo apachectl stop
    // 查看 Apache 版本
    httpd -v
  • 相关阅读:
    SpringMVC注解控制器详解
    在自己的服务器上安装GitBook
    基于UDP协议的网络编程
    RabbitMQ安装使用详解
    Python3.4 + Django1.7.7 搭建简单的表单并提交
    暴力枚举 UVA 10976 Fractions Again?!
    暴力枚举 UVA 725 Division
    思维 UVALive 3708 Graveyard
    DFS(剪枝) POJ 1011 Sticks
    DFS+模拟 ZOJ 3861 Valid Pattern Lock
  • 原文地址:https://www.cnblogs.com/redirect/p/6112154.html
Copyright © 2011-2022 走看看