Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

digger's avatar

Tutorial Problems

Hi, I'm (quite) new to php, but certainly Laravel, so please bear with me - what I'm about to say may be stupid (sorry)...

I have a lamp stack on Ubuntu, and installed Laravel no problem. I then started the tutorials, and in the Intermediate Task List tutorial I ran into problems... if they are not real problems then please feel free to enlighten me.

  1. The Intermediate Task List on GitHub uses a composer.json file with "laravel/framework": "5.1.*" 5.1 doesn't seem to support make:auth as instructed in the tutorial

  2. The application on GitHub doesn't actually run (on my lamp stack, anyway). When you click Login or Register, you get "The requested URL /auth/register was not found on this server."

  3. The index.php file is in http://myserver/quickstart/public. I have no idea why it's in public and not in the app root, so I would be grateful for guidance on this. I don't want to write an app where people have to go to a sub-dir instead of the site root.

Thanks for your help!

0 likes
4 replies
skliche's avatar

@digger Re 1: I think you are mixing up the tutorials. 5.1 doesn't use make:auth, 5.2 does.

Re 2: I guess your .htaccess is not correct. Try this one.

Re 3: The index.php in the public directory is the main entry point. It creates your application. Therefor all request that are not targeting images, css, etc. are rewritten by your .htaccess to get handled by that file. In a production environment your server root would be the public directory, the app directory not being available directly.

Edit: Out of curiosity, did you get the basic tutorial working (then your htaccess file should be fine) or did you just start with the intermediate one?

digger's avatar

Hi skliche,

Thanks for your reply! I never got the basic tutorial to run, but since I had the idea I thought I'd move on to the intermediate...

I followed the Intermediate Task List tutorial, and I can't get it to run. In my browser I get a blank screen, and my apache error log says:

PHP Fatal error: Uncaught exception 'ReflectionException' with message 'Class App\Http\Kernel does not exist' in /var/www/html/quickstart/vendor/laravel/framework/src/Illuminate/Container/Container.php:738\nStack trace:\n#0 /var/www/html/quickstart/vendor/laravel/framework/src/Illuminate/Container/Container.php(738): ReflectionClass->__construct('App\\Http\\Kernel')\n#1 /var/www/html/quickstart/vendor/laravel/framework/src/Illuminate/Container/Container.php(633): Illuminate\Container\Container->build('App\\Http\\Kernel', Array)\n#2 /var/www/html/quickstart/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(674): Illuminate\Container\Container->make('App\\Http\\Kernel', Array)\n#3 /var/www/html/quickstart/vendor/laravel/framework/src/Illuminate/Container/Container.php(230): Illuminate\Foundation\Application->make('App\\Http\\Kernel', Array)\n#4 /var/www/html/quickstart/vendor/laravel/framework/src/Illuminate/Container/Container.php(735): Illuminate\Container\Container->Illuminate\Container\{closure}(Object(Illuminate in /var/www/html/quickstart/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 738

I then tried to compare my files against those from GitHub (so I could check I had constructed all files correctly), but the GitHub version is way different to what I had made, in files I hadn't even edited. I'm assuming the GitHub version is built on 5.1, and mine is built on 5.2. The tutorial assumes you have 5.2 (as you are instructed to "make:auth"), so it's impossible to troubleshoot where I have gone wrong against the completed GitHub files that are built on 5.1.

I then downloaded the complete quickstart-intermediate from GitHub (git clone https://github.com/laravel/quickstart-intermediate quickstart2) I changed the group of all files to www-data (here's one problem I solved on my own) I changed the .env and the config/database.php to match my db/un/pw settings I used your .htaccess file (thanks very much), and......

IT RAN!! (Until.......) Until I clicked the Register button in the app, and then I got:

Not Found The requested URL /auth/register was not found on this server.

I just can't get either my version made via the tutorial or the complete version straight from GitHub to run.

Any help and advice would be greatly appreciated. Has anyone else tried to run the GitHub application on a Lamp Stack?

Regards,

Nick385's avatar

@digger Instead of using lamp i highly advice using homestead. it includes all drivers for laravel. also if you want to push a project to aws or digital ocean its easy.

lamp etc is good for ftp projects like wordpress, to develop apps i would run a server. Homestead is very easy to setup. 1 Quick tip when you are going to use gulp wich youre gonna use in the future. run the Gulp command in youre project outside homestead ssh, its way faster.(worry's for later ;))

documentation: https://laravel.com/docs/5.2/homestead

tutorial: https://laracasts.com/series/laravel-5-fundamentals/episodes/1 https://laracasts.com/series/laravel-5-fundamentals/episodes/2

skliche's avatar
skliche
Best Answer
Level 42

@digger Ok, you've stumbled over a common problem, the code you've downloaded doesn't play nicely with systems where public is not the server's root directory. Try the following changes.

/resources/views/layouts/app.blade.php
replace

<li><a href="/auth/register"><i class="fa fa-btn fa-heart"></i>Register</a></li>
<li><a href="/auth/login"><i class="fa fa-btn fa-sign-in"></i>Login</a></li>
...
<li><a href="/auth/logout"><i class="fa fa-btn fa-sign-out"></i>Logout</a></li>

with these lines

<li><a href="{{ asset("/auth/register") }}"><i class="fa fa-btn fa-heart"></i>Register</a></li>
<li><a href="{{ asset("/auth/login") }}"><i class="fa fa-btn fa-sign-in"></i>Login</a></li>
...
<li><a href="{{ asset("/auth/logout") }}"><i class="fa fa-btn fa-sign-out"></i>Logout</a></li>

/resources/views/auth/register.blade.php
replace

<form action="/auth/register" method="POST" class="form-horizontal">

with these lines

<form action="{{ asset("/auth/register") }}" method="POST" class="form-horizontal">

/resources/views/auth/login.blade.php
replace

<form action="/auth/login" method="POST" class="form-horizontal">

with these lines

<form action="{{ asset("/auth/login") }}" method="POST" class="form-horizontal">

Notice how I replaced all URLs with URLs wrapped in asset() calls. This makes sure that your relative path gets added. You may stumble across this in other places as well. I haven't check the whole code, just these places to get you started.

Please or to participate in this conversation.