Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to place Laravel and use artisan commands?

I'm trying laravel php framework recently. I'm using Windows 7 and XP (tries to install it on both), XAMPP 1.8.1 and PHP 5.4.7.

So confusing.

  1. In many articles (including laravel's documentation itself), I meet up many artisan codings.
    What is artisan? I can't define it myself so clear. I end up with articles that not giving any simple explanation.
    I got commands tutorials like php artisan key:generate and else.
    But I always failed, with this error on Command Prompt : 'php' is not recognized as an internal or external command, operable program or batch file.
    I got solution like "change directory to laravel root",
    So, I chdir-ed to C:\xampp\htdocs\laravel\public\ but nothing works.

  2. I that right to access my laravel site with browser via localhost/laravel/public/?
    So, if I try to upload it to my public site, I should place those items in my root folder (/)?

like image 485
Henry J Avatar asked Mar 28 '13 12:03

Henry J


People also ask

What is artisan command in Laravel?

Artisan is the name of the command-line interface included with Laravel. It provides a number of helpful commands for your use while developing your application. It is driven by the powerful Symfony Console component.


1 Answers

You are getting the error when calling php.exe because windows command prompt is not tracking your PHP installation. You can fix that by adding it into PATH environment variable:

Go to "My Computer" > "Properties" > "Advanced" > "Environment Variables" > "Path", add a semicolon (;) at the end and then path to your PHP binaries folder, which in your case is C:\xampp\php

After you restart the command prompt PHP and Artisan should work fine.

As to your second question, "public" folder should be your server's (or virtual host's) DocumentRoot. There is no need to expose the whole framework on your web server.

like image 59
pandasauce Avatar answered Nov 15 '22 01:11

pandasauce