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

roadrunner89's avatar

PHP Artisan not working

Hi everyone,

Super newbie here (sorry if this question leads to a head smacking moment). I have just started learning about Laravel (using a Windows operating system) and attempted to make a controller via command line and received a 'Fatal Error' message:

php artisan make:controller PagesController

[Symfony\Component\Debug\Exception\FatalErrorException] syntax error, unexpected end of file.

Could someone please help me with this? Composer is up to date. Thanks!

0 likes
7 replies
JillzTom's avatar

You might want to delete all compiled Blade views in storage/framework/views and let Blade re-compile the views.

Check for any control structure (i.e. an 'if' or 'foreach') and see if you correctly ended the structure. ie: @if with @endif or @foreach with @endforeach .

larabie's avatar

Hi I encounter the same issue but still did not worked. I deleted all instances of @foreach (used in the previous presentation-laravel from scratch) but still the same error.... is there a need to refresh something?

Thanks for the help.

Snapey's avatar

Access your site and it should show the same error, except it will tell you where the error is.

1 like
EmilMoe's avatar

Just give us the content of storage/framework/laravel.log then we can see the actual error.

Snapey's avatar

hmmm, it seems the person that I replied to 'Access your site and it should show the same error' deleted their question. How rude.

ironcladgeek's avatar

@roadrunner89 I had the exact same problem in middle of one of my projects. After checking everything I figured out that I have missed a semi-colon (;) at one of my routes at routes.php file! Check that file.

5 likes
EliasSoares's avatar

@roadrunner89

Try running php artisan -vvv

This will print the full error log. Probably in one of your PHP files you have some wrong syntax. This will show you where to look at.

Please or to participate in this conversation.