Home >Backend Development >PHP Tutorial >php5.6-Apache2.4-mysql5.6 environment configuration (win7_64 bit), php5.6apache2.4_PHP tutorial

php5.6-Apache2.4-mysql5.6 environment configuration (win7_64 bit), php5.6apache2.4_PHP tutorial

WBOY
WBOYOriginal
2016-07-12 08:56:30913browse

php5.6-Apache2.4-mysql5.6 environment configuration (win7_64 bit), php5.6apache2.4

------ --------------------------------------------------

★Software tools: (When downloading, please pay attention to download the corresponding version, the installation details of different versions may be different!!)

1>httpd-2.4.18-win64-VC14.zip Download address: http://www.apachelounge.com/download/

2>php-5.6.16-Win32-VC11-x64.zip Download address: http://windows.php.net/download/

3>mysql-5.6.29-winx64.zip Download address: http://dev.mysql.com/downloads/mysql/

4> MySQL-Front Download address: http://www.mysqlfront.de/

----------------------------------------- ------------

★ Before installation, you need to know: : win7 configuration Environment variables (taking mysql as an example)

(After configuring the environment variables of the corresponding command, there is no need to "enter the directory" operation)

Copy the absolute path of /bin after mysql installation to the location in Figure 7 below (note that there must be a ; sign at the end of each path), and then confirm the changes

----------------------------------------- --------------------------

1. Installation configurationApache2.4.18(httpd-2.4.18-win64-VC14.zip)

1>Enter the httpd-2.4.18-win64-VC14.zip download address and download this compressed package. (As shown below)

(Attached download address: http://www.apachelounge.com/download/)

2>Extract the downloaded httpd-2.4.7-win64-VC11.zip out of the Apache24 folder and put it in your own installation directory (My directory is D:/File/phpEnv)

3> Then enter the conf directory (Apache24/conf/) under the Apache24 folder, find the httpd.conf file, open it with Notepad and modify some of the contents inside

(The following paths should be modified accordingly according to your own decompression path!!)

(1) Modify the root path of ServerRoot Apache:

<span><</span><span>37</span><span>行</span><span>></span>ServerRoot "c:/Apache24"  改成=>  ServerRoot "D:/File/phpEnv/Apache24"

(2) Modify ServerName to your host name:

(Line 255) ServerName www.example.com:80 Remove the # in front. This attribute is needed when starting Apache from the command line.

(3) Modify the main folder directory accessed by DocumentRoot Apache, which is the location of php and html code files. The default path of Apache is under htdocs (Apache24/htdocs), which has a simple entry file index.html. This path can be modified by yourself. I configure it in my newly created www folder (D:/File/phpEnv/www), and you can make corresponding changes according to your own needs.

<span>(249行) DocumentRoot "c:/Apache24/htdocs"
        </span><span><</span><span>Directory</span><span>"c:/Apache24/htdocs"</span><span>></span><span>
改为=>
        DocumentRoot "D:/File/phpEnv/www "
        </span><span><</span><span>Directory </span><span>"D:/File/phpEnv/www "</span><span>></span>

(4) Modify the entry file configuration: DirectoryIndex Under normal circumstances, we use index.php, index.html, index.htm as the entry point for web projects . Apache's default entry is only index.html, and you need to add support for the other two. Of course, the settings of this entry file can be increased or decreased according to your own needs. If the requirements are stricter, you can only write one index.php, so that the entry in the project is It can only be index.php

(282行)<span><</span><span>IfModuledir_module</span><span>></span><span>
        DirectoryIndex index.html
       </span><span></</span><span>IfModule</span><span>></span><span>
改为=>
       </span><span><</span><span>IfModuledir_module</span><span>></span><span>
        DirectoryIndex index.php index.htm index.html
        </span><span></</span><span>IfModule</span><span>></span>

(5) 设定serverscript的目录:

<span>(366行)ScriptAlias/cgi-bin/ "c:/Apache24/cgi-bin/"
改为=> ScriptAlias/cgi-bin/ " D:/File/phpEnv/Apache24/cgi-bin"</span>

(6)改cgi-bin目录:

<span>(382行)
        </span><span><</span><span>Directory</span><span>"c:/Apache24/cgi-bin"</span><span>></span><span>
          AllowOverride None
          Options None
          Require all granted
        </span><span></</span><span>Directory</span><span>></span><span>
改为=>
        </span><span><</span><span>Directory </span><span>"D:/File/phpEnv/Apache24/cgi-bin"</span><span>></span><span>
            AllowOverride None
            Options None
            Require all granted
        </span><span></</span><span>Directory</span><span>></span>

4>接下来就可以启动Apache了

鼠标点击(开始)à(运行)(或Win+R),输入cmd,打开命令提示符。

然后进入D:/File/phpEnv/Apache24/bin目录下回车httpd回车,如图所示.

<span>cmd进入指定目录命令(以我的路径为例):
       D:    回车 
       cd D:/File/phpEnv/Apache24/bin   回车</span>

没报错就可以测试了(保持该命令窗口为打开的状态!!!!!!)。

(如果配置好了httpd命令的环境变量就不用“进入目录”操作)

可以把Apache24/htdocs目录下的index.html放到D:/File/phpEnv/www目录下,用浏览器输入地址:localhos或127.0.0.1访问会出现“It works”那么就说明Apache已经正确安装并启动了。

也可以自己写一个简单的index.html文件也可以打开。

 

5>Apache加入到window服务启动项里面并设置成开机启动

1.先关闭httpd的服务(将❹中命令窗口关闭即可)

2.重新打开一个新的命令窗口进入到D:/File/phpEnv/Apache24/bin目录下:

添加HTTP服务的命令是:httpd.exe -kinstall -n "servicename"  servicename是服务的名称,我添加的是:httpd.exe -k install -n "Apache24"命令成功后会有成功的提示,此时你可以在window服务启动项中看到Apache24这个服务

3.然后点击启动就可以了,如果不想设置成开机启动的话也可以将启动类型修改为手动。

4.如果要卸载这个服务的话,先要停止这个服务,然后输入httpd.exe -k uninstall -n "Apache24"卸载这个服务。

5.当然也可以通过D:/File/phpEnv/Apache24bin下面的ApacheMonitor.exe来启动Apache

如此Apache的配置就基本完成了。

--------------------------------------------------------------------------

二、安装配置php-5.6.16 (php-5.6.16-Win32-VC11-x64.zip)

1>进入php-5.5.16-Win32-VC11-x64.zip下载地址,下载此压缩包。(如下图)要下载线程安全版的php!!!!!!!!

(附下载地址: http://windows.php.net/download/)

打开链接后选择相应版本,然后进入下载页面(千万得注意下载的版本!!!!!)

2>将下载的php-5.5.10-Win32-VC11-x64.zip解压到安装到自己喜喜欢的目录下我的是(D:/File/phpEnvphp)

 

3>将目录下的php.ini-development文件复制一份并改名为php.ini它是php的配置文件

 

4>为Apache服务添加php支持

打开Apache的配置文件http.conf在最后加上以下代码:

《Apache加入php时注意空格(下方为正确写法)PS:我装的时候因为这个问题取法启动Apache24耽误了好久》

<span># php5 support
LoadModule php5_module D:/File/phpEnv/php/php5apache2_4.dll
AddType application/x-httpd-php .php .html .htm
# configure thepath to php.ini
PHPIniDir "D:/File/phpEnv/php"</span>

我是添加在LoadModule下面

添加的时候要保证你的php5apache2_4.dll文件确实存在php5.5的早期版本里面是没有这个文件的,不过高点版本里面已经有了,可以打开php安装目录找下这个文件

PHPIniDir" D:/File/phpEnv/php"这个就是你的php根目录

 

5>重启Apache服务器。

 

6>测试。

删除www中其他文件index相关文件,新建一个index.php,内容为e2d0e752df2c971bca1fcef6e50119b4保存,访问出现php的信息就说明php已经成功安装。

备注:

Php的一些常用配置修改:(D:/File/phpEnv/php/php.ini)

时区的设置:date.timezone = Asia/Shanghai

错误报告等级:error_reporting = E_ALL这个在开发模式下可以全部打开。

---------------------------------------------------------------------------

三、安装配置mysql-5.6.29 (mysql-5.6.29-winx64.zip )

1>进入mysql-5.6.29-winx64.zip下载地址,下载此压缩包。(如下图)

(附链接:http://dev.mysql.com/downloads/mysql/)

1)打开链接后选择相应版本,然后进入下载页面(千万得注意下载的版本!!!!!)

2)选择“No thanks, just start my download.”“不,谢谢,开始我的下载”就可以下载了

 

2>安装(解压):解压到自己喜欢的文件夹

 

3>配置默认文件

在mysql-5.7.10-winx64目录下,新建一个my.ini。复制下面的代码保存就可以了。my.ini会替换掉下面的my-default.ini文件。ini文件是window里面的配置文件。保存里面各种默认的数据。

 

把my.ini中代码全部替换为以下代码(将安装路径的两条代码改成自己的路径!!!):

<span>[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8 
[mysqld]
#skip-grant-tables
#设置3306端口
port = 3306 
# 设置mysql的安装目录
basedir=D:\File\phpEnv\MySQL\mysql-5.6.29-winx64
# 设置mysql数据库的数据的存放目录
datadir=D:\File\phpEnv\MySQL\mysql-5.6.29-winx64\data
# 允许最大连接数
max_connections=200
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB</span>

4> 以管理员身份进入命令行窗口安装mysql服务

(以下的cmd进入路径操作,如果配置了环境变量就不用进入/bin目录)

在cmd中进入mysql-5.6.29-winx64.zip解压出的/bin目录下(进入相应目录命令:cd D:…/…/…)

输入mysqld install 安装mysql

(将服务删除:sc delete MySQL //这里的MySQL是你要删除的服务名)

然后输入 net start mysql 启动服务

成功后如下图(我是已经配置好了环境变量所以直接输入安装命令和启动命令就行):

5>首次设置新密码

/bin目录下输入mysql -uroot -p ,默认是没有密码的,直接按回车进入(我是已经设置密码了)

按照以下操作添加数据库密码:

 

<span>1.进入mysql数据库:
mysql> use mysql;
Database changed
2.给root用户设置新密码
mysql> update user set password=password("新密码") where user="root";
Query OK, 1 rows affected(0.01 sec)
Rows matched: 1 Changed: 1Warnings: 0
3.刷新数据库(一定要记得刷新)
mysql>flush privileges;        
QueryOK, 0 rows affected (0.00 sec)
4.退出mysql:
mysql> quit</span>

 

6>为php添加mysql支持

1)736行); extension_dir = "ext",去掉前面的“;”,并改为extension_dir ="D:\phpEnv\php\ext"打开php的扩展支持,ext文件夹下有很多php的扩展支持.dll文件,感兴趣可以看一下。

2)然后就是打开php的mysql扩展了

<span>(890、891行)去掉前面的&ldquo;;&rdquo;
        extension=php_mysql.dll
        extension=php_mysqli.dll</span>

当然也可以打开895行的php_pdo_mysql.dll启用php的pdo支持我一般都用这个。

注:有很多扩展选择,你要用到什么,去掉前面的“;”就可以了。当然如果要添加其他的扩展支持如redis支持,php本身可能没有提供相应的dll文件,就需要自己去找到相应版本的dll添加到ext文件夹中,然后在配置文件中添加一个extension=…

 

3) 完成之后,重启Apache24

在访问phpinfo的时候就可以看到(在浏览器输入地址:localhost或127.0.0.1)

 

7>mysql图形界面管理软件安装(这里用的是:MySQL-Front):

1)进入下载链接下载最新版MySQL-Front:

 

(MySQL-Front下载地址:http://www.mysqlfront.de/)

2)开始安装(一全图片形式说明):

                                                                                        Started to write on: 2016.3.24

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1112812.htmlTechArticlephp5.6-Apache2.4-mysql5.6 environment configuration (win7_64 bit), php5.6apache2.4 - -------------------------------------------------- -- ★Software tools: (When downloading, please pay attention to download the corresponding version,...
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