Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run Laravel without Artisan?

I have PHP with Apache2 and I want to run Laravel Framework without Artisan but I can't! Does anyone know how to run Laravel without Artisan?

like image 694
SyncroIT Avatar asked Feb 28 '15 23:02

SyncroIT


5 Answers

I've solved the problem. The problem was in my htaccess and in mod_rewrite (Apache2). Now I can connect to my application only by typing localhost/public..

If anyone wants to make the application public, the more easy and fastest way is:

  • Rename the "server.php" file in root directory, in "index.php"
  • Move your .htaccess from public folder to root directory
  • Make your directory accessible to Apache2 (set correct file/folder permissions).

Thanks to all users for help! :)

Important Edit

Consider using Apache Virtual Hosts (pointing the virtual host to the /public Laravel folder) instead of renaming server.php to index.php because by doing this you will need to prefix "public/" when you use the Laravel's asset() function in your views.

When working with other devs, who are using a different configuration, this might be a big problem because they will be able to see the assets while you will not (or viceversa).

like image 156
SyncroIT Avatar answered Oct 13 '22 00:10

SyncroIT


I am using xampp in mac

  1. inside htdocs / run following command: $ laravel new myblog

  2. After successfully creation run following and do following: sudo chmod -R o+w storage/

  3. Change server.php to index.php (@ root directory)

  4. copy .htaccess from public to root directory

  5. (optional) in resources / app.blade.php → Change to <link href="{{ asset('public/css/app.css') }}" rel="stylesheet">

  6. run following http://localhost/myblog/

like image 36
Vinod Joshi Avatar answered Oct 13 '22 01:10

Vinod Joshi


Easy solution without any code alterations

  • Point your domain to public/ folder of laravel project.
  • Enjoy!

~OR~

  • Create .htaccess in project folder and add below code. This code will rewrite domain to public/ folder of your laravel project
RewriteEngine on

RewriteRule ^(.*)?$ ./public/$1

Hope this is helpful.

like image 22
Rohan Khude Avatar answered Oct 13 '22 01:10

Rohan Khude


Laravel framework is such a pain in the ass for startup PHP guys who are not much oriented about what the hell composer is, and where .phar files are coming from and what are they, and why "Artisan" is trying to ruin your PHP life. Most people are looking for a PHP framework where all you have to do is download, extract and code. Nevertheless to make things work, you just need to install Laravel through Composer:

composer global require "laravel/installer=~1.1"

Anyway, you can download Composer from http://getcomposer.org/

After you install Laravel through Composer, navigate to your local server's directory. You might want to use "CD" (Change directory) to do this. (I'm speaking of CLI, whether you're in BASH(Linux) or CMD(Windows)) Then create your very first Laravel project by typing this in command line:

laravel new mywebsite1

Replace "mywebsite1" with your first project name. And there you go, you're ready to hit the Laravel road.

In my case, I'm still using Windows XP in such development and shifts back to Ubuntu Trusty whenever I feel like I want to smell Linux scent. So Composer installs "Laravel installer" in:

%userprofile%\Application Data\Composer\vendor\bin

So I make a backup copy of this directory so the next time I use Laravel on other unit with no internet connection, I just have to extract it, and run:

laravel new [myprojectname]

within the same directory and copies the resulting folder to my XAMPP's htdocs or WAMP's www folder.

Anyway I'm just sharing my approach for those with no 24/7 internet connection at home :p

After all it's still best for everyone to read the documentation on how to properly install Laravel: http://laravel.com/docs/5.0/installation

like image 45
Allen Linatoc Avatar answered Oct 13 '22 01:10

Allen Linatoc


Artisan is simply a command line interface. It is made to do things like create and run migrations and automate building certain objects within your Application, etc. Essentially, it's only made to help facilitate creating and working on your Application, not run it.

If you are having issues actually getting the Application to run, it is likely a problem with either your PHP or Apache, not Artisan.

like image 41
cchapman Avatar answered Oct 13 '22 02:10

cchapman