DEV Community

Cover image for php is not recognized as an internal or external command error (solution)
Osman Forhad
Osman Forhad

Posted on

php is not recognized as an internal or external command error (solution)

Once I was working with a Laravel project which was in my xampp server and now it is in laragon server
In the min time I was going to run that project so I was type and run php artisan serve command on my terminal and it’s show me an error the error look like below
Alt Text
But there is another thing was happening. Thing is that the project isn’t run by artisan command but the same project is working when I type localhost/public/ on my web browser. So that time I was too much queries why this is happening actually. After a long time, I realize the mistake made by me. Actually, it’s a very funny what I done.
I realize that the composer I was install 1st time I was define php location from my xampp server. But now I am trying to run project by using php command which is in my laragon server. Ha ha….… what a funny mistake.
Finally, I think what I should do to avoid this php is not recognized as an internal or external command error. So, I remove my composer and again install fresh composer. Now in the composer installation time I was carefully define my php location which is in my laragon server.
And finally, php artisan server command is working nicely.
.
that's it.
.
Happy Coding.
osman forhad
Mobile & Web Application Developer💻

Top comments (0)