为什么我不能在Laravel路径中使用'php artisan'cmd(Win) [英] Why can't I use 'php artisan' cmd in Laravel path (Win)

查看:106
本文介绍了为什么我不能在Laravel路径中使用'php artisan'cmd(Win)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Ubuntu中学习Laravel,并且命令"php artisan"在终端的laravel文件夹路径中起作用.

I have tried to learn Laravel in Ubuntu and the command "php artisan' worked in the laravel folder path in the terminal.

我刚刚开始在Win7中执行此操作,我在cmd.exe中键入"cd c:\ wamp \ www \ myproject"以将路径更改为laravel文件夹(artisan文件位于此文件夹中).

I just start to do it in Win7, I typed "cd c:\wamp\www\myproject" in cmd.exe to change the path to the laravel folder (artisan file is in this folder).

此后,我尝试使用"php artisan",但收到以下消息:'php'不被识别为内部或外部命令,可操作程序或批处理文件."

After that I tried "php artisan" but I got this message "'php' is not recognized as an internal or external command, operable program or batch file."

我错过了什么吗?命令行显示有C:\ wamp \ www \ myproject> php artisan,我已经仔细检查了文件路径是否正确.

Did I miss something? The command line showed there is C:\wamp\www\myproject>php artisan and I have double checked the file path is right.

我哪一步做错了?

推荐答案

发生错误是因为Windows命令行不知道在哪里可以找到php.exe二进制文件.

The error is occurring because the windows command line doesn't know where to find the php.exe binary.

在Windows 7中,单击开始",然后在开始菜单搜索栏中键入环境".选择为您的帐户编辑环境变量".在早期版本的Windows中,右键单击我的电脑",然后单击属性".转到属性窗口中的高级选项卡,然后单击底部标签为环境变量"的按钮.

In Windows 7 click START and then type 'environment' into the start-menu search bar. Choose 'edit environment variables for your account'. In previous version of windows right-click My Computer then click properties. Go to advanced tab in the properties window and click the button on the bottom labelled, "Environment Variables."

现在,找到PATH环境变量并将PHP二进制文件的路径添加到其中.路径用分号分隔.

Now, find the PATH environment variable and add the path to your PHP binary to it. Paths are delimited with semi-colons.

示例PATH变量可能类似于:

An example PATH variable may look like:

C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;D:\apps\Git\bin

只需将PHP二进制文件的路径添加到末尾,不要忘记中间的分号.我的PHP二进制文件的路径为D:\ work \ apps \ xampp177 \ php,因此我的PATH变量将如下所示:

Simply add the path to your PHP binary to the end, don't forget the intervening semi-colon. The path to my PHP binary is D:\work\apps\xampp177\php so my PATH variable will look like this:

C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;D:\apps\Git\bin;D:\work\apps\xampp177\php

请注意,该路径不包含php.exe.路径仅是包含php.exe的文件夹.

Notice that the path doesn't contain php.exe. The path is only the folder which contains php.exe.

保存PATH之后,关闭您的CLI,然后重新打开它,使用artisan应该不会有任何问题.

After the PATH has been saved, close your CLI, reopen it, and you should have no further problems using artisan.

这篇关于为什么我不能在Laravel路径中使用'php artisan'cmd(Win)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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