How to run Laravel without Artisan?

前端 未结 11 2139
不思量自难忘°
不思量自难忘° 2020-12-05 03:24

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?

相关标签:
11条回答
  • 2020-12-05 04:09

    Easy solution without any code alterations

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

    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
    

    In case, if you want to do this in local then create .htaccess files as mentioned in above point with the given code and do the following

    $ cd your_project_path/
    $ php -S localhost:8000
    

    Hope this is helpful.

    0 讨论(0)
  • 2020-12-05 04:10

    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

    0 讨论(0)
  • 2020-12-05 04:11

    Well , the easy way is
    1) create a new folder"Project" and copy all files except public folder content to project folder
    2) copy all files of public folder to root
    and you can run laravel without artisan.If you rename server.php and copy .htaccess , it may make trigger some error when you try to run auth artisan command.I experienced problem with auth command.

    0 讨论(0)
  • 2020-12-05 04:13

    I got mine to work by adding the following block to my apache vhost conf file

    <VirtualHost *:8003>
        ServerName myproject
        DocumentRoot "/path/to/myproject/public"
    </VirtualHost>
    

    and running sudo chown -R daemon storage from my project root

    0 讨论(0)
  • 2020-12-05 04:22

    I am using xampp in mac

    1. inside htdocs / run following commadn $ 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

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

    0 讨论(0)
提交回复
热议问题