网站、小程序服务器环境搭建XAMPP+ThinkPHP

这篇具有很好参考价值的文章主要介绍了网站、小程序服务器环境搭建XAMPP+ThinkPHP。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

Windows系统搭建环境,首先到官网XAMPP download | SourceForge.net下载XAMPP应用程序,安装时勾选下面选项进行安装。

  • Apache
  • MySQL
  • PHP
  • Perl
  • Phpmyadmin:数据库管理工具,点击下图的XAMPP控制面板中MySQL行对应的“Admin”按钮,就会自动打开跳转到phpmyadmin管理页面。

安装完成后,会运行弹出XAMPP的控制面板,如下图

xampp thinkphp,服务器,运维

可以点击Apache和MySQL的启动按钮:如下图,如果程序端口没有被占用都是可以正常运行的

xampp thinkphp,服务器,运维

成功运行如下:

xampp thinkphp,服务器,运维

此时验证,可以在浏览器中输入localhost:80,会显示如下网页界面,说明你的程序正常运行。

xampp thinkphp,服务器,运维

并且在你指定的目录中会有如下XAMPP文件夹:

xampp thinkphp,服务器,运维

注意XAMPP安装解压后,自动整合安装了MySQL和PHP、Apache服务程序,你不用在绞尽脑计想着再去对应的官网下载相应的应用程序了。只需要添加环境变量即可。

为XAMPP文件夹中的MySQL和PHP程序添加系统环境变量,在path中添加:

xampp thinkphp,服务器,运维

 使用Phpmyadmin:数据库管理工具,点击下图的XAMPP控制面板中MySQL行对应的“Admin”按钮,就会自动打开跳转到phpmyadmin管理页面。

xampp thinkphp,服务器,运维

如图:

xampp thinkphp,服务器,运维

另外通过XAMPP安装的MySQL数据库的默认密码是空,也就是没有密码,使用命令行进入MySQL时,提示输入密码,直接按回车键即可进入:

C:\Users\Administrator>mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 57
Server version: 10.4.32-MariaDB mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

上图最后一行是Composer包依赖管理工具,可以到官网下载安装,composer安装后会自动添加此环境变量,无需手动添加。另外需要注意的是安装Composer应用程序之前,一定要配置好XAMPP文件夹中的PHP应用程序的环境变量,composer应用需要自动添加PHP应用程序的文件夹的路径。

Composer的官网:Composer (getcomposer.org)

或者在这里下载安装(你可以暂时不看,先按照我的文章进度走):安装 - ThinkPHP官方手册

xampp thinkphp,服务器,运维安装完composer后,运行在命令行中输入composer -v即可查看版本号。


D:\phpdev\www>composer -v
   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 2.6.5 2023-10-06 10:11:52

Usage:
  command [options] [arguments]

Options:
  -h, --help                     Display help for the given command. When no command is given display help for the list command
  -q, --quiet                    Do not output any message
  -V, --version                  Display this application version
      --ansi|--no-ansi           Force (or disable --no-ansi) ANSI output
  -n, --no-interaction           Do not ask any interactive question
      --profile                  Display timing and memory usage information
      --no-plugins               Whether to disable plugins.
      --no-scripts               Skips the execution of all scripts defined in composer.json file.
  -d, --working-dir=WORKING-DIR  If specified, use the given directory as working directory.
      --no-cache                 Prevent use of the cache
  -v|vv|vvv, --verbose           Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
  about                Shows a short information about Composer
  archive              Creates an archive of this composer package
  audit                Checks for security vulnerability advisories for installed packages
  browse               [home] Opens the package's repository URL or homepage in your browser
  bump                 Increases the lower limit of your composer.json requirements to the currently installed versions
  check-platform-reqs  Check that platform requirements are satisfied
  clear-cache          [clearcache|cc] Clears composer's internal package cache
  completion           Dump the shell completion script
  config               Sets config options
  create-project       Creates new project from a package into given directory
  depends              [why] Shows which packages cause the given package to be installed
  diagnose             Diagnoses the system to identify common errors
  dump-autoload        [dumpautoload] Dumps the autoloader
  exec                 Executes a vendored binary/script
  fund                 Discover how to help fund the maintenance of your dependencies
  global               Allows running commands in the global composer dir ($COMPOSER_HOME)
  help                 Display help for a command
  init                 Creates a basic composer.json file in current directory
  install              [i] Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json
  licenses             Shows information about licenses of dependencies
  list                 List commands
  outdated             Shows a list of installed packages that have updates available, including their latest version
  prohibits            [why-not] Shows which packages prevent the given package from being installed
  reinstall            Uninstalls and reinstalls the given package names
  remove               [rm] Removes a package from the require or require-dev
  require              [r] Adds required packages to your composer.json and installs them
  run-script           [run] Runs the scripts defined in composer.json
  search               Searches for packages
  self-update          [selfupdate] Updates composer.phar to the latest version
  show                 [info] Shows information about packages
  status               Shows a list of locally modified packages
  suggests             Shows package suggestions
  update               [u|upgrade] Updates your dependencies to the latest version according to composer.json, and updates the composer.lock file
  validate             Validates a composer.json and composer.lock

 然后我们通过Composer来下载ThinkPHP框架构建的网站应用程序:

下载ThinkPHP程序框架也是看这(你可以暂时不看,先按照我的文章进度走):安装 - ThinkPHP官方手册

xampp thinkphp,服务器,运维

文档这里说的WEB根目录就是XAMPP文件夹中的htdocs目录,这个地址也就是我们网站在浏览器中访问的本地地址,如下:

xampp thinkphp,服务器,运维

进入htdocs文件夹中,单击直接选中这个文件夹地址,输入cmd后回车,这样就在当前文件夹目录中进入cmd命令行模式:

xampp thinkphp,服务器,运维

执行如下命令行:其中newsite就是通过ThinkPHP框架构建的应用所在的文件夹名(命令行会自动创建):

composer create-project topthink/think newsite

如果此时,你的下载报错说php没有开启zip和unzip/7z的压缩解压功能的话,提示中说我们的XAMPP文件夹中的PHP程序的没有开启压缩和解压功能,需要通过php.ini配置开启解压功能,用记事本打开配置文件 D:\User\XAMPP\php\php.ini,按住Ctrl+F搜索zip,把前面的分号删掉,即可启用解压功能,启用其他功能也是类似操作去掉分号报错即可,如下:

xampp thinkphp,服务器,运维

xampp thinkphp,服务器,运维

此时在网站根目录下再次执行命令行:composer create-project topthink/think newsite

xampp thinkphp,服务器,运维

下载成功!

打开htdocs目录,你会看到composer构建的网站应用程序:

xampp thinkphp,服务器,运维

进入newsite文件夹如下:

xampp thinkphp,服务器,运维

在浏览器中验证一下,构建的项目是否成功,需要在浏览器中访问:localhost/newsite/public

xampp thinkphp,服务器,运维

 看到此页面说明我们的服务器搭建成功,网站应用程序也创建成功!

下面就是开发任务了!文章来源地址https://www.toymoban.com/news/detail-799194.html

到了这里,关于网站、小程序服务器环境搭建XAMPP+ThinkPHP的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 用XAMPP在Windows系统构建一个本地Web服务器

    By Jackson@ML 本文简要介绍如何获取和安装XAMPP以实现Windows环境下本地Web服务器的过程,希望对广大网友和学生有所帮助。 所谓本地Web服务器,即使用本地主机名即可访问的Web站点,例如:在浏览器中打开https://127.0.0.1,或者https://localhost可打开的非空页面,就说明存在本地主机

    2024年02月04日
    浏览(42)
  • 服务器网站搭建(一)

    一台服务器,我买的腾讯云新加坡的。根据需求选择配置。 重置密码: 自己设置的密码要记住: 登录: 安装宝塔(centos系统),参考官网: 执行命令: 如下,遇到选择就输入y回车: 最后输出如下,请复制保存到一个文档,下次登录直接复制账号密码即可: 回到服务器,打

    2024年02月08日
    浏览(38)
  • 使用IIS服务器搭建一个网站

    IIS全称为Internet Information Services,是一种Web服务组件。通过在自己电脑上安装好IIS服务,就可以把你自己的电脑当作一个网站的服务器。 Step1、 控制面板——程序——程序和功能——启用或关闭windows功能 Step2、 重启一下电脑,在开始菜单栏里面找到IIS服务 Step3、 进入IIS管理

    2024年02月05日
    浏览(34)
  • 用服务器搭建网站需要做什么

    网站建设是一个广义的术语,涵盖了许多不同的技能和学科中所使用的生产和维护的网站。不同领域的网页设计,网页图形设计,界面设计,创作,其中包括标准化的代码和专有软件,用户体验设计和搜索引擎优化。许多人常常会分为若干个工作小组,负责网站不同方面的设

    2024年02月13日
    浏览(36)
  • 【服务器Midjourney】Midjourney网站0基础搭建

    目录 🌺【前言】 🌺【准备】 🌺【宝塔搭建MJ】 🌼1. 给服务器添加端口 🌼2. 使用Xshell连接服务器 🌼3. 安装docker 🌼4. 安装Midjourney程序 🌼5. 绑定域名+申请SSL证书 🌼6. 更新网站

    2024年01月25日
    浏览(38)
  • 使用腾讯云轻量应用服务器搭建网站教程

    腾讯云轻量应用服务器怎么搭建网站?太简单了,轻量服务器选择宝塔Linux镜像,然后在宝塔面板上添加站点,以WordPress建站为例,腾讯云服务器网来详细说下腾讯云轻量应用服务器搭建网站全流程,包括轻量服务器配置选择、镜像系统、防火墙开端口及网站上线超详细教程

    2024年02月15日
    浏览(38)
  • 【建站教程】使用阿里云服务器怎么搭建网站?

    使用阿里云服务器快速搭建网站教程,先为云服务器安装宝塔面板,然后在宝塔面板上新建站点,阿里云服务器网以搭建WordPress网站博客为例,阿小云来详细说下从阿里云服务器CPU内存配置选择、Web环境、域名解析到网站上线全流程: 目录 步骤一:云服务器配置选择 步骤二

    2024年02月07日
    浏览(45)
  • Linux—Web服务器(静态、动态网站的搭建)

    1.1www所用的协议 HTTP超文本传输协议,是互联网上最广泛的一种网络协议,所有的www文件都必须遵守这个标准 它是建立在TCP上一种的无状态连接,整个基本的工作流程是客户端发送一个HTTP请求,说明客户端想要访问的资源和请求的动作,服务端收到请求之后,服务端开始处理

    2024年02月06日
    浏览(40)
  • 腾讯云轻量应用服务器搭建WordPress网站教程

    腾讯云百科分享使用腾讯云轻量应用服务器搭建WordPress网站教程流程,WordPress 是全球最流行的开源的博客和内容管理网站的建站平台,具备使用简单、功能强大、灵活可扩展的特点,提供丰富的主题插件。腾讯云轻量应用服务器提供 WordPress 应用镜像,您可以使用它快速搭建

    2024年02月13日
    浏览(35)
  • streamlit——搭建作业、文件上传网站(代码编写、服务器部署)

    由于我平时需要收集 各种类型的作业文件 。但传统的微信收文件方式很让我头大,假如我们班级有39人,那么我需要接收39个人的消息文件,并 另存到本地某文件夹 下,还需要帮不规范的 命名进行修改 。 后来我尝试过使用Flask编写上传文件,并部署到服务器上。不仅速度很

    2024年02月10日
    浏览(42)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包