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

calciferrr's avatar

Help PHP Artisan serve ";

when i run php artisan serve in the terminal it automatically puts "; with it and in every page of my website it displays "; at the top.

0 likes
12 replies
Sinnbeck's avatar

Sounds like you have some random file with a ; before <?php

1 like
Sinnbeck's avatar

@calciferrr is it on github so we can help look? If you create a new project from scratch is the problem there as well?

1 like
calciferrr's avatar

@Sinnbeck When i create a new project, its all normal. In my project though, its running ( php artisan serve "; ) instead of php artisan serve. When i deleted all routes, it diplays, page not found but at the top it has the ( "; ) . Unfortunately I'm only a junior programmer and i dont think i can share the code on github

1 like
Sinnbeck's avatar

@calciferrr it can be in any file sadly, so it might be hard to track down. To make sure that it isn't in the vendor folder, you can try deleting it and running composer install

Yeah if you are new, github might be hard to learn just for this :)

1 like
Snapey's avatar
Snapey
Best Answer
Level 122

@calciferrr make sure also that you don't put closing ?> on your .php files as anything following it will be echoed to the screen before any content.

It sounds like something related to the framework on the command line, so not web.php or your controllers, check all your config files, and service providers. Any file you can think you might have modified.

1 like
Sinnbeck's avatar

@calciferrr another idea is to create a new project and copy over one folder at a time, and see when the new project starts doing the same. Then you will know what folder to look at

1 like
calciferrr's avatar

@Sinnbeck OMG, thanks a lot it actually worked. I have modified function boot in app service provider. I just deleted the closing tag.

Sinnbeck's avatar

@calciferrr awesome. Think this one goes to @snapey as he suggested closing tags :) be sure to never end php files with them

1 like

Please or to participate in this conversation.