Apache+MySQL+PHP development environment installation process under Mac apache download apache official website apache distribution

WBOY
Release: 2016-07-29 08:50:15
Original
919 people have browsed it

Max comes with its own Apache and PHP servers. No additional installation is required. This article will introduce the relevant configurations.

First: Apache

Enter in the terminal, the following command can start the Apache server:

 //启动
 sudo apachectl-k start  
  //重新启动
 sudo apachectl -k restart
Copy after login

Verification:

Enter in the browser: http://127.0.0.1, it will show It Works! , which proves that the server has been started.

But since the default site is located in the system path, we modify it to a custom path. So you need to make relevant configurations

Modify the site location:

Enter

cd /etc/apache2/
 sudo vim httpd.conf // 会提示输入密码,输入后回车即可
 英文下输入: /DocumentRoot,查找,
 注:1:注意区分大小写;2:要修改两个地方,故要进行两次查找。
Copy after login

in the terminal. After the first search, modify:

apache mysql 认证,apache连接mysql,apache与mysql整合,apache mysql php集成,apache mysql未启动,apache+php+mysql,mysql启动不了apache,apache+java+mysql,apache+php+mysql环境,apache+php+mysql配置,apache+php+mysql下载,apache2.2 php mysql,apache下载,apache官网,apache配

After the second search, modify

apache mysql 认证,apache连接mysql,apache与mysql整合,apache mysql php集成,apache mysql未启动,apache+php+mysql,mysql启动不了apache,apache+java+mysql,apache+php+mysql环境,apache+php+mysql配置,apache+php+mysql下载,apache2.2 php mysql,apache下载,apache官网,apache配

After modification: wq Save and exit, restart the server, and place the html file in the customized path to access it.

Second: Configure the PHP server:

1: Enter the command in the terminal:

cd /etc/apache2
 sudo vim httpd.conf
 按 /php,进行搜索,把带有LoadModule php5…..这一行的#(注释符号)去掉即可。

 ![](http://images.cnitblog.com/blog2015/589133/201503/231410352395226.png)
Copy after login

2: Enter the command in the terminal:

 cd /etc/
 sudo cp php.ini.default php.ini
Copy after login

Restart the server, place the php file under the customized site path, and you can access the php content.

Third: MySQ installation:
MySql download: http://dev.mysql.com/downloads/mysql/ MySqlWorkbench download: http://dev.mysql.com/downloads/workbench/

Just install it directly after downloading, just default all the way

MySql Configuration:

Open the terminal and enter:

vim ~/.bash_profile
Copy after login

Enter i to edit, then paste the following content

# mysql
alias mysql='/usr/local/mysql/bin/mysql'
alias mysqladmin='/usr/local/mysql/bin/mysqladmin'
# ls
alias ls='ls -G'
Copy after login

Press ESC key and enter: wq
In this way, you can enter mysql by directly typing mysql in the terminal. Enter exit to exit

Change the administrator password of MySql, enter in the terminal:

mysqladmin -u root password "root"

启动Mysql服务
     sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
停止Mysql服务
     sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
重启Mysql服务
     sudo /Library/StartupItems/MySQLCOM/MySQLCOM restart
Copy after login

At this point, the installation and configuration of Apache+MySQL+PHP is completed.

Attachment: An introduction to the vim editor
vim has two modes:
1: Command mode

 shift+v -> 选中一行
 y -> 复制一行
 yy -> 复制当前行 (yank current line)
 p -> 在当前行的下一行复制粘贴的内容
 x -> 删除一个字符
 :wq -> 保存退出
 :q! -> 不保存退出
 i -> 进入编辑
 / -> 按/再输入字符可进行查找
Copy after login

2: Editing mode, you can edit the document directly, press the esc key to exit the editing mode

The above introduces the installation process of Apache+MySQL+PHP development environment under Mac, including the content of Apache and Mysql. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template