在本地主机下安装 Yii2 Starter Kit [英] Installing Yii2 Starter Kit under Localhost

查看:26
本文介绍了在本地主机下安装 Yii2 Starter Kit的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Yii2 Frameworks 的新手,我被推荐安装使用 Yii2 Starter Kit 快速启动 Web 框架(参见 https://github.com/trntv/yii2-starter-kit).

I am a complete newbie at Yii2 Frameworks and I have been recommended to install the Yii2 Starter Kit to get a web framework up fast (see https://github.com/trntv/yii2-starter-kit).

我正在尝试使用 PHPStorm 和内置网络服务器在本地开发环境中安装该工具包.我已按照此处设置指南中的所有(适用)说明进行操作:

I am trying to install the kit in a local development environment with PHPStorm and the in-built web-server. I have followed all the (applicable) instructions in the setup guide here:

https://github.com/trntv/yii2-starter-kit/blob/master/docs/installation.md#important-notes

安装后,我似乎无法浏览任何本地主机网址 (http://):

After installation, I can't seem to browse any of my localhost urls (http://):

本地主机:63342/yii-starter-kit

localhost:63342/yii-starter-kit

localhost:63342/yii-starter-kit/backend

localhost:63342/yii-starter-kit/backend

localhost:63342/yii-starter-kit/frontend

localhost:63342/yii-starter-kit/frontend

如果我的 PHPStorm 启动文件夹设置为yii-startup-kit"项目文件夹:

Nor if my PHPStorm startup folder is set to the "yii-startup-kit" project folder:

本地主机:63342/

localhost:63342/

我的安装似乎在根项目文件夹中没有 index.php,也没有在后端或前端文件夹中,因此当我浏览任何地方时,我收到在此服务器上找不到请求的资源"错误.有人能告诉我我错过了什么吗?是否需要在 Vagrant/Docker(虚拟机?)下运行.

I seem to be left with an installation that has no index.php in the root project folder, nor in backend or frontend folders so hence when I browse anywhere I get a "The requested resource was not found on this server" error. Could someone tell me what I am missing? Is it a requirement to run under Vagrant/Docker (VMs?).

谢谢.

附言我也看到过这个问题:部署 yii2-starter-kit Yii2 安装时出错 然而,据我所知,Yii Starter 套件现在可以在单域模式下工作.

P.S. I have also seen this question: Error deploying yii2-starter-kit Yii2 installation, however from what I can see, the Yii Starter kit now works in a single domain mode.

推荐答案

看来(出于某种原因)Yii2-starter-kit 旨在重写"所有后端和前端 URL.这意味着 PHP 的简单内置服务器无法处理该任务(如果没有做很多摆弄来实现基于 PHP 的重写规则).

It appears that (for some reason) Yii2-starter-kit is designed to "rewrite" all the backend and frontend URLs. This implies that PHP's simple in-built server can't handle the task (without doing quite a bit of fiddling to implement a PHP-based rewrite rule).

最后,安装 Apache 是使框架正常工作的唯一解决方案.这需要实现安装指南中提到的虚拟主机"配置.

In the end, installing Apache was the only solution to get the framework to work. This requires implementing the "virtual host" configuration mentioned in the Installation Guide.

这篇关于在本地主机下安装 Yii2 Starter Kit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆