Home  >  Article  >  Backend Development  >  apache php mysql development environment installation tutorial_php example

apache php mysql development environment installation tutorial_php example

WBOY
WBOYOriginal
2016-08-17 13:02:40860browse

Apache php mysql development environment setup tutorial, shared with everyone for your reference

0. Resource link:

360 cloud disk: https://yunpan.cn/c6wpzYwbfmLJY (extraction code: 0190)

1. First install the compiler environment

The following files:

2. Install apache+php+mysql

The following files:


2.1. Install apache

2.1.1 installation

Just a few key points

2.1.1.1


2.1.1.2


2.1.1.3


2.1.1.4.Enter: localhost in the browser address bar. If the following page appears, it means you have successfully installed apache


2.1.2. Configure apache

2.1.2.1


2.1.2.2


2.1.2.3. Enter confextrahttpd-vhosts.conf in the apache installation directory


2.1.2.4. Modify the system hosts file


2.1.2.5.


2.1.2.6.

Find the apache icon on the desktop and restart apache


2.1.2.7.

Enter: haha.com in the browser, the following page will appear


2.2. Install php

2.2.1 installation

Right-click the php compressed package and select "Extract File"


2.2.2. Configure php and associate it with apache

2.2.2.1.If the php.ini file does not exist, create a new file php,ini in the php installation directory, copy the contents of the file php.ini-development in the php installation directory to php,ini, and Modify


2.2.2.2.Enter the httpd.conf file in the apache installation directory


2.2.2.3. Create a new "a.php" in the blog folder and write the following content


2.2.2.4. Restart apache

2.2.2.5.Test

Enter haha.com/a.php in the browser, the following page will appear


2.3. Install mysql

2.3.1 installation

2.3.1.1

2.3.1.2

2.3.1.3

2.3.1.4

2.3.1.5

2.3.1.6


2.3.2修改php安装目录下的ini文件


2.3.3.测试

在blog文件中新建文件 " test_sql.php"


2.3.4.重启apache

2.3.5.测试

在浏览器输入 haha.com/test_sql.php ,显示如下页面


2.4.上手mysql

2.4.1.连接到数据库服务器


2.4.2.告诉服务器您的字符集

2.4.2.1.查看方法,右击dos窗口,选择“属性”


2.4.2.2.使用该命令来设置字符集:set names xxx;


2.4.3.在输入sql语句时最好不要用记事本来写代码,否则可能出现错误ERROR1064

2.5配置Sublime Text 2(下载该软件请参考文首云盘链接)

2.5.1.编辑sublime Text/Data/Packages/User/open_broswer.py

url_map = { 'D:\\software\\server\\apache2.2\\htdocs' : 'http://localhost/',}

[注意] D:\\www\\应为你的localhost指向的真实目录

2.5.2.安装PHP语法提示
工具栏:Preferences->Package Settings->SublimeLinter->Settings - User

{"sublimelinter": true,"sublimelinter_executable_map":{  "php":"D:\\software\\server\\php5.4\\php.exe"}}

把上面的地址替换为你实际的php.exe的地址

2.6.安装时出现的的问题

2.6.1.无法访问localhost

是因为我们之前配置apache时执行了这一步


解决方法

打开apache安装目录的conf\extra\httpd-vhosts.conf,如下图修改,修改后记得重启apache


记得重启apache

2.6.2.Sublime Text 2 中文乱码问题

在Sublime中新建php文件,输入 echo '中文';  转到浏览器后,浏览器出现乱码,没有正常显示中文。

解决方法:

在代码开头,即 422a35a6e9a99101953657a46cfe111e

3.更改网站根目录

譬如把网站根目录从以前的D:\software\server\apache2.2\htdocs改为D:\software\server\www

3.1.打开apache安装目录下的conf\httpd.conf文件

3.1.1


3.2.


3.2.修改apache的httpd-vhosts.conf文件


3.3.重启apache

3.4.配置Sublime Text 2

编辑sublime Text/Data/Packages/User/open_broswer.py

<span style="font-size:14px;">url_map = { 'D:\software\server\www' : 'http://localhost/',}</span>

[注意] D:\\www\\应为你的localhost指向的真实目录

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。

Statement:
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