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 --- ...
随机推荐
- 很好的容斥思想 HDU 5514
题目描述:有n只青蛙,m个石头(围成圆圈).第i只青蛙每次只能条a[i]个石头,问最后所有青蛙跳过的石头的下标总和是多少? 思路:经过绘图我们发现,每次跳过的位置一定是k*gcd(a[i], m).然 ...
- swfupload在chrome中点击上传图片按钮无反应的解决办法
chrome 22.0.XXXXX dev版上传图片按钮点击无反应原因:是GOOGLE的内建Flash PPAPI外挂所导致的. 问题原因: 由于Google浏览器(Chrome),在最新测试版22. ...
- ASP.NET MVC3 系列教程 - 目录
ASP.NET MVC3 系列教程 - 目录 I:ASP.NET MVC3 新增的功能 ASP.NET MVC3 系列教程 - Razor视图引擎基础语法ASP.NET MVC3 系列教程 - V ...
- FileSystemXmlApplicationContext方法的绝对路径问题
public AgentServer(Socket c,String confDir) { this.client = c; ApplicationContext ac = new FileSyste ...
- 安卓常用 widget
验证码 public class SpinnerImg extends ImageView { /** * 完成选择后启动另外一个spinner */ private ItemListener ite ...
- [转]SSL协议详解
背景介绍 最近在看<密码学与网络安全>相关的书籍,这篇文章主要详细介绍一下著名的网络安全协议SSL. 在开始SSl介绍之前,先给大家介绍几个密码学的概念和相关的知识. 1.密 ...
- HDU-1072 Nightmare (bfs+贪心)
Nightmare Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other) Total Sub ...
- HDU 1686 Oulipo(KMP+计算匹配成功次数)
一开始总是超时,后来发现还是方法没找对,这个跟普通KMP不太一样的就是,KMP匹配成功的时候会完全跳过已经匹配成功的匹配段,至少我掌握的是.那么如何避免这样的问题呢,举个栗子啊 原串为ABABA,模式 ...
- String Stringbuilder Stringbuffer的区别
String 字符串常量StringBuffer 字符串变量(线程安全)StringBuilder 字符串变量(非线程安全) 简要的说, String 类型和 StringBuffer 类型的主要性能 ...
- 转:loadruner报错:Step download timeout(120 seconds)的一个解决方法
一个网友问了我一个问题如下:loadruner报错:Error -27728: Step download timeout (120 seconds) 如何解决语法检查通过,但是在并发执行一个查询时候 ...