apache2.4+php7.4+mysql5.3基本配置

Apache2.4:  httpd-2.4.46-win64-VC15.zip

PHP7:  php-7.4.16-Win32-vc15-x64.zip

Mysql5.7:  mysql-5.7.17-winx64.zip

 

一、Apache安装:

i.  获取Apache:  www.apachelounge.con/download/

ii.  解压:  e:/web/apache2.4

iii.  配置conf/httpd.conf:  

c:/Apache24  =>  e:/web/apache2.4 #ServerName www.example.con:80    =>    ServerName www.example.con:80

iv.  CMD(管理员): 

e: cd e:/web/apache2.4/bin httpd.exe -k install  net start apache2.4  

net stop apache2.4  #停止服务

注:当修改配置文件时,要关闭服务再开。

 

二、PHP安装

i.  获取PHP:  php.net

ii.  解压PHP:  e:/web/php

iii.  创建配置文件并修改:  cp  e:/web/php/php.ini-development  e:/web/php/php.ini

#修改 ;extension=php_curl.dll    =>    extension=php_curl.dll ;extension=php_gd2.dll    =>    extension=php_gd2.dll ;extension=php_mbstring.dll    =>    extension=php_mbstring.dll ;extension=php_mysqli.dll    =>    extension=php_mysqli.dll ;extension=php_pdo_mysql.dll    =>    extension=php_pdo_mysql.dll
;extension_dir = ext  =>  extension_dir = e:/web/php/ext

 

iv.  在e:/web/apache2.4/conf/httpd.conf引入PHP模块:  

LoadModule php7_module E:/web/php/php7apache2_4.dll <FilesMatch \.php$>     setHandler application/x-httpd-php </FilesMatch> PHPIniDir E:/web/php   #修改 #修改前 <IfModule dir_module>     DirectoryIndex index.html </IfModule> #修改后 <IfModule dir_module>     DirectoryIndex index.php index.html </IfModule>

v.  重启apache服务

 

三、MySQL安装

i.  获取MySQL:  https://dev.mysql.com/downloads/

ii.  解压MySQL:  e:/web/mysql5.7

iii.  创建并编写配置文件:e:/web/mysql5.7/my.ini

[mysqld] basedir = e:/web/mysql5.7 datadir = e:/web/mysql5.7/data port = 3306

iv.  CMD(管理员):

e: cd e:/web/mysql5.7/bin mysqld.exe -install  mysqld.exe --initialize-insecure  net start mysql  net stop mysql   mysql -h localhost -u root  set password for 'root'@'localhost' = password('123456');  mysql -h localhost -u root -p123456