怎样利用XAMPP搭建本地php环境

本文介绍如何使用XAMPP启动MySQL并配置虚拟主机,同时涵盖了Redis的安装与常见问题解决方法,如密码错误等问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

启动xampp

这里写图片描述

点击mySql的admin

这里写图片描述

下载mySql 和运维人员要取账号登录

这里写图片描述

登录成功后,把表复制到本地localhost

注意

新建表的选项:

这里写图片描述

这里写图片描述


Hosts文件主要作用是定义IP地址和主机名的映射关系,是一个映射IP地址和主机名的规定。可以用文本文件打开!当用户在浏览器中输入一个需要登录的网址时,系统会首先自动从Hosts文件中寻找对应的IP地址,一旦找到,浏览器会立即打开对应网页,如果没有找到,则浏览器会将网址提交DNS服务器进行IP地址解析。这也是提高快速打开网页的方法!

这里写图片描述

这里写图片描述

找到如下图文件

这里写图片描述

代码如下:

# Virtual Hosts
#
# Required modules: mod_log_config

# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at 
# <URL:http://httpd.apache.org/docs/2.4/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
##NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ##ServerName or ##ServerAlias in any <VirtualHost> block.
#
##<VirtualHost *:80>
    ##ServerAdmin webmaster@dummy-host.example.com
    ##DocumentRoot "C:/xampp/htdocs/dummy-host.example.com"
    ##ServerName dummy-host.example.com
    ##ServerAlias www.dummy-host.example.com
    ##ErrorLog "logs/dummy-host.example.com-error.log"
    ##CustomLog "logs/dummy-host.example.com-access.log" common
##</VirtualHost>

##<VirtualHost *:80>
    ##ServerAdmin webmaster@dummy-host2.example.com
    ##DocumentRoot "C:/xampp/htdocs/dummy-host2.example.com"
    ##ServerName dummy-host2.example.com
    ##ErrorLog "logs/dummy-host2.example.com-error.log"
    ##CustomLog "logs/dummy-host2.example.com-access.log" common
##</VirtualHost>


<VirtualHost *:80>
 ServerName yxeplus.com
 DocumentRoot "F:/work/yxeplus_web/public"
<Directory "F:/work/yxeplus_web/public"> 
 Options FollowSymLinks IncludesNOEXEC Indexes
 DirectoryIndex index.html index.htm index.php
 AllowOverride all 
 Order Deny,Allow 
 Allow from all 
 Require all granted
</Directory>
</VirtualHost>

<VirtualHost *:80>
 ServerName yxcfu-web.com
 DocumentRoot "F:/work/yxcfu-web/public"
<Directory "F:/work/yxcfu-web/public"> 
 Options FollowSymLinks IncludesNOEXEC Indexes
 DirectoryIndex index.html index.htm index.php
 AllowOverride all 
 Order Deny,Allow 
 Allow from all 
 Require all granted
</Directory>
</VirtualHost>

<VirtualHost *:80>
 ServerName yxcfu-qbx-web.com
 DocumentRoot "F:/work/yxcfu-qbx-api/public"
<Directory "F:/work/yxcfu-qbx-api/public"> 
 Options FollowSymLinks IncludesNOEXEC Indexes
 DirectoryIndex index.html index.htm index.php
 AllowOverride all 
 Order Deny,Allow 
 Allow from all 
 Require all granted
</Directory>
</VirtualHost>


<VirtualHost *:80>
 ServerName yxbao2.com
 DocumentRoot "F:/work/yxbao-web"
<Directory "F:/work/yxbao-web"> 
 Options FollowSymLinks IncludesNOEXEC Indexes
 DirectoryIndex index.html index.htm index.php
 AllowOverride all 
 Order Deny,Allow 
 Allow from all 
 Require all granted
</Directory>
</VirtualHost>

下载radis

双击redis-server.exe启动radis

这里写图片描述

注意

遇到tp框架会提示radis密码错误解决方案


1.和管理员要取radis密码,文件夹在如下图所示:

这里写图片描述


2.radis必须从cmd窗口启动:

命令行:cd redis-server.exe空格redis.conf

这里写图片描述


重启xampp 即可

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值