简体   繁体   English

如何从phar文件安装Laravel?

[英]How do I install Laravel from phar file?

I downloaded the laravel.phar file, renamed it to laravel , moved it to /usr/local/bin , then made it executable by all. 我下载了laravel.phar文件,将其重命名为laravel ,将其移至/ usr / local / bin ,然后使其可执行。

In my home directory, I tried laravel new sandbox , but nothing happens. 在我的主目录中,我尝试了laravel new sandbox ,但没有任何反应。

What did I do wrong? 我做错了什么?

Thanks. 谢谢。

Do not bother renaming the file, and do not bother with /usr/local/bin. 不要费心重命名文件,也不要打扰/ usr / local / bin。 Just place laravel.phar in the folder where you are going to use it. 只需将laravel.phar放在要使用它的文件夹中即可。

Then make sure you have the PHP curl module installed. 然后确保安装了PHP curl模块。 On OpenSuse: 在OpenSuse上:

sudo zypper install php5-curl

Then create your new Laravel application with the following command (notice you use the php command to execute the .phar file): 然后使用以下命令创建新的Laravel应用程序(请注意,您使用php命令执行.phar文件):

php laravel.phar new <project-name> 

eg php laravel.phar new sandbox . 例如php laravel.phar new sandbox A new subfolder will be created with the project-name as its name, containing the skeleton of a Laravel application. 将创建一个新的子文件夹,其项目名称为其名称,包含Laravel应用程序的框架。

或者只是运行:

curl -O http://laravel.com/laravel.phar && chmod +x laravel.phar && mv laravel.phar /usr/local/bin/laravel

This method worked for me. 这种方法对我有用。

  1. Create batch script and name it laravel.bat 创建批处理脚本并将其命名为laravel.bat
  2. Paste the following codes in your laravel.bat file 将以下代码粘贴到laravel.bat文件中

@ECHO OFF @ECHO OFF

php "%~dp0laravel.phar" %* php“%~dp0laravel.phar”%*

3.Store the laravel.bat file in the same directory as the downloaded PHAR file (laravel.phar) 3.将laravel.bat文件存储在与下载的PHAR文件相同的目录中(laravel.phar)

4.Include the directory path in your environmental variables. 4.在环境变量中包含目录路径。

Then you are good to go.... just launch CMD and test it by typing laravel then hit return 然后你很高兴....只需启动CMD并通过键入laravel然后点击返回来测试它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM