我对laravel完全陌生。我想在我的项目中使用它
我从http://bitnami.com下载了WAMP Stack 7.1.26-2,令我惊讶的是,它已经预装了laravel。
它位于frameworks
文件夹中,如下所示:C:\Bitnami\wampstack-7.1.26-2\frameworks
但是我的问题是我不知道该如何使用laravel。它不在htdocs
文件夹中,正如我认为的那样。
如果我去http://localhost,我只会看到bitnami欢迎页面
如果我转到http://localhost/laravel,它说找不到页面
我在网上搜索了答案,但大多数时候,它指向此链接: https://docs.bitnami.com/google/apps/#laravel
但是在该页面上,我没有看到与laravel有关的信息。通过浏览器搜索,我什至找不到'laravel'这个词。
如果我运行composer create-project laravel/laravel myproject --prefer-dist
,
我明白了:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\o.o amoo>composer create-project laravel/laravel myproject --prefer-dist
PHP Warning: PHP Startup: Unable to load dynamic library 'C:/Bitnami/wampstack-
7.0.0RC7-/php/ext\php_solr.dll' - The specified module could not be found.
in Unknown on line 0
Installing laravel/laravel (v5.5.28)
- Installing laravel/laravel (v5.5.28): Loading from cache
Created project in myproject
> @php -r "file_exists('.env') || copy('.env.example', '.env');"
PHP Warning: PHP Startup: Unable to load dynamic library 'C:/Bitnami/wampstack-
7.0.0RC7-/php/ext\php_solr.dll' - The specified module could not be found.
in Unknown on line 0
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 73 installs, 0 updates, 0 removals
- Installing symfony/thanks (v1.1.0): Loading from cache
- Installing symfony/polyfill-ctype (v1.10.0): Loading from cache
Invalid zip file, retrying...
- Installing symfony/polyfill-ctype (v1.10.0): Loading from cache
Invalid zip file, retrying...
- Installing symfony/polyfill-ctype (v1.10.0): Loading from cache
Failed to download symfony/polyfill-ctype from dist: 'C:\Users\o.o amoo\
myproject\vendor/symfony/polyfill-ctype/4199a310f6ba3768faedee6d521ec615' is not a zi
p archive.
Now trying to download from source
- Installing symfony/polyfill-ctype (v1.10.0): Cloning e3d8262452
[RuntimeException]
Failed to clone https://github.com/symfony/polyfill-ctype.git via https, ssh p
rotocols, aborting.
- https://github.com/symfony/polyfill-ctype.git
Cloning into 'C:\Users\o.o amoo\myproject\vendor\symfony\polyfill-ctype'...
fatal: unable to access 'https://github.com/symfony/polyfill-ctype.git/': Fa
iled to connect to github.com port 443: Timed out
- git@github.com:symfony/polyfill-ctype.git
Cloning into 'C:\Users\o.o amoo\myproject\vendor\symfony\polyfill-ctype'...
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--r
epository REPOSITORY] [--repository-url REPOSITORY-URL] [--dev] [--no-dev] [--no
-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vc
s] [--remove-vcs] [--no-install] [--ignore-platform-reqs] [--] [<package>] [<dir
ectory>] [<version>]
C:\Users\o.o amoo>
这让我感到困惑。它确实在以下目录中创建了一个名为myproject
的项目:C:\ Users \ o.o amoo>
但是无法安装laravel ??
如果我尝试php artisan serve
,我会得到:
Could not open input file:artisan
因此,我可以使用laarvel访问myproject
吗?如何?如果不可以,我该怎么办?
有人请指出正确的方向...
谢谢!
答案 0 :(得分:0)
好的,让我们从为什么在C:/ Users中安装项目开始,这是因为您在composer create-project laravel/laravel myproject --prefer-dist
中使用了--prefer-dist。
-prefer-dist:与--prefer-source相反,如果可能,composer将从dist安装。这样可以大大加快构建的安装速度 服务器和其他用例,其中通常不运行 供应商。如果您使用git,这也是规避git问题的一种方法 没有正确的设置。
其次,您可能会遇到错误,可能是因为您位于需要其他权限的目录中,至少对我而言是如此。
如果您已正确安装Laravel,则应该能够通过终端导航到所需位置,并且只有在您要输入laravel new
的目录中时,才使用C:/Code/myproject
BUT您仍在C/Code
中,您需要做laravel new myproject
如果这对您不起作用,建议您根据文档确认您已安装所有内容
最后但最重要的一点是,我想为您再说一件事,在Laravel中使用Homestead
确实更方便。您可以在这里阅读有关Homestead,如何安装,配置和使用它的更多信息:
https://laravel.com/docs/5.8/homestead