MAC OSX 10.10 下安装PHP环境
Apache和PHP已经在系统里面预装好了,只要你开启即可使用。这篇文章给大家介绍如何开启并设置好PHP开发环境。
1.开启默认Apache服务
打开终端命令行,输入如下命令就会开启Apache了.然后输入top命令查看进程是否含有http。
sudo apachectl start
2.修改Apache配置文件
在Finder右键点击“前往文件夹”后输入“/etc/apache2/ ”然后打开httpd.conf。我们要修改开启PHP组件和虚拟目录。
去掉在168、169行的#号
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
LoadModule php5_module libexec/apache2/libphp5.so
211行前面加上#号
#Require all denied
修改默认目录
DocumentRoot "/Users/wise/site/default"
<Directory "/Users/wise/site/default">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options FollowSymLinks Multiviews
MultiviewsMatch Any #
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride All #
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
虚拟目录,修改文件/etc/apache2/extra/httpd-vhosts.conf
#默认目录
<VirtualHost *:80>
DocumentRoot "/Users/wise/site/default"
ServerName default
</VirtualHost>
#工具
<VirtualHost *:80>
DocumentRoot "/Users/wise/site/db"
ServerName db
</VirtualHost> #个人项目
<VirtualHost *:80>
DocumentRoot "/Users/wise/site/jinzhe"
ServerName jinzhe
<Directory "/Users/wise/site/jinzhe">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost> <VirtualHost *:80>
DocumentRoot "/Users/wise/site/yckit"
ServerName yckit
<Directory "/Users/wise/site/yckit">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost> <VirtualHost *:80>
DocumentRoot "/Users/wise/site/dmku"
ServerName dmku
<Directory "/Users/wise/site/dmku">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost> #私人项目 <VirtualHost *:80>
DocumentRoot "/Users/wise/site/sms"
ServerName sms
</VirtualHost> <VirtualHost *:80>
DocumentRoot "/Users/wise/site/icrobot"
ServerName icrobot
<Directory "/Users/wise/site/icrobot">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost> <VirtualHost *:80>
DocumentRoot "/Users/wise/site/lbdlq"
ServerName lbdlq
<Directory "/Users/wise/site/lbdlq">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost> <VirtualHost *:80>
DocumentRoot "/Users/wise/site/baidu"
ServerName baidu
<Directory "/Users/wise/site/baidut">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost> #公司项目 <VirtualHost *:80>
DocumentRoot "/Users/wise/site/fishernuts"
ServerName fishernuts
<Directory "/Users/wise/site/fishernuts">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
3.修改HOSTS文件
在Finder右键点击“前往文件夹”后输入“/etc ”然后打开hosts。
#工具
127.0.0.1 db
#个人项目
127.0.0.1 jinzhe
127.0.0.1 dmku
127.0.0.1 yckit
127.0.0.1 yckit.api
#私单项目
127.0.0.1 sms
127.0.0.1 icrobot
127.0.0.1 lbdlq
127.0.0.1 baidu
127.0.0.1 jcm
#公司项目
127.0.0.1 fishernuts
4.安装MYSQL
到官网下载:http://dev.mysql.com/downloads/mysql/ 选DMG格式的就好了。他会帮你一键安装好。
复制出一份。php.ini
cp /etc/php.ini.default /etc/php.ini
创建mysql socket(不设置这个无法连接phpmyadmin)
sudo mkdir /var/mysql
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
然后修改php.ini中的内容(原因是连接时候php默认去找/var/mysql/mysql.sock了,但是MAC版本的MYSQL改动了文件的位置,放在/tmp下了。)
mysql.default_socket = /tmp/mysql.sock
设置别名和密码
alias mysql='/usr/local/mysql/bin/mysql'
alias mysqladmin='/usr/local/mysql/bin/mysqladmin'
mysqladmin -u root password "123456"
MAC OSX 10.10 下安装PHP环境的更多相关文章
- Mac 10.12下安装python3环境
python3感觉用虚拟环境会比较好操作一些,也不用直接卸载python2. 一.基于brew快速安装 # 安装python3 brew install python3 # 安装pip(好像3自带pi ...
- Mac 下安装Ruby环境(转)
步骤1 - 安装 RVM RVM 是干什么的这里就不解释了,后面你将会慢慢搞明白. $ curl -L https://get.rvm.io | bash -s stable 期间可能会问你sudo管 ...
- tensor搭建--windows 10 64bit下安装Tensorflow+Keras+VS2015+CUDA8.0 GPU加速
windows 10 64bit下安装Tensorflow+Keras+VS2015+CUDA8.0 GPU加速 原文见于:http://www.jianshu.com/p/c245d46d43f0 ...
- 在Windows/Ubuntu下安装OpenGL环境(GLUT/freeglut)与跨平台编译(mingw/g++)
GLUT/freeglut 是什么? OpenGL 和它们有什么关系? OpenGL只是一个标准,它的实现一般自带在操作系统里,只要确保显卡驱动足够新就可以使用.如果需要在程序里直接使用OpenGL, ...
- centos下安装php环境
centos下安装php环境 安装apache yum install httpd-devel 启动apache /etc/init.d/httpd start 安装mysql yum install ...
- CentOs下安装PHP环境的步骤
前言 在CentOs环境下安装php开发环境,需要首先安装一些源文件,然后使用yum命令直接安装即可,在Fedora 20 源中已经有了PHP的源,直接可以使用以下命令安装即可: # yum inst ...
- 【Linux】CentOS7.0下安装JDK环境
写在前面:此次试验是在CentOS7上面安装的,亲测成功. 所需工具:JDK1.8安装包,xftp 具体步骤: 1,首先使用xftp连接到自己的虚拟机,然后查看是否有"/usr/java/j ...
- Java java jdk在Linux下安装与环境变量的配置
java jdk在Linux下安装与环境变量的配置 by:授客 QQ:1033553122 linux环境:CentOS-6.0-x86_64-bin-DVD1.iso [root@localhost ...
- 【android开发】如何在Linux平台下安装JDK环境
原文:http://android.eoe.cn/topic/android_sdk Linux平台JDK安装 本文主要描述如何在Linux平台下安装JDK环境.进入网页:http://www.ora ...
- Linux下安装php环境并且配置Nginx支持php-fpm模块[www]
Linux下安装php环境并且配置Nginx支持php-fpm模块 http://www.cnblogs.com/freeweb/p/5425554.html 5分钟搭建 nginx +php --- ...
随机推荐
- WEBROOT根目录 <%=request.getContextPath()%>
WEBROOT根目录 <%=request.getContextPath()%> == ${pageContext.request.contextPath}
- android,view的执行过程onDraw、onSizeChanged,onFinishInflate
小试view的执行过程,此是入门,高手绕道. ----------------------------------------------------------------------------- ...
- php使用Header函数,PHP_AUTH_PW和PHP_AUTH_USER做用户验证及缺点
在php中,可以使用Header函数做一些有趣的事情,用户验证就是其中一个很有意思的功能.具体用法: Header("WWW-Authenticate: Basic realm=" ...
- url重写步骤
url重写:在global文件中,在application_BeginRequest事件中1:获取URL string url=Request.AppRelativeCurrentExecutionF ...
- 笨方法学python--多行,转义序列
1 输入多行字符串的方法有2个,一个是使用换行符 \n.另一个是使用 "三引号". 2 针对不同的符号,有很多这样的"转义序列"(escape sequence ...
- 报错 BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext 的解决方法
这个普遍是因为tomcat 的 jar包问题,重新导入一下tomcat的jar包就OK了.
- shell 入门教程
打开文本编辑器,新建一个文件,扩展名为sh(sh代表shell),扩展名并不影响脚本执行,见名知意就好. 一 惯例,第一个shell #!/bin/bash echo "Hello ...
- POJ 1182 食物链 经典并查集+关系向量简单介绍
题目: 动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形.A吃B, B吃C,C吃A. 现有N个动物,以1-N编号.每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种. 有 ...
- PoolManager 简单使用
如图,创建空物体并命名 PoolManager,添加 脚本 spawn pool,并添加 如上图右边一些 参数,prefab为 Resources中 的预置体. 添加 空物体并 改名,如上图,并添加脚 ...
- IE6下整站的bug详解
<1>文字不居中:加一个行高: <2>png文件作为背景不显示: <!--[if IE 6]> <script src="js/DD_belated ...