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

SomeT's avatar
Level 1

Confused by local environment

I have laragon installed on windows using php storm, at the moment I can only use composer from the command line in phpstorm, in windows generally, I don't have php.exe set to path at all in my system environment variables, now this is where I am getting really confused, I presume I either add that to my path, use the terminal in laragon or setup a path within phpstorm itself (I don't think that is even possible) then further to my confusion if I did a command then with it setup in whatever way of 'php artisan something something' does that then always add it to my local project ready for deployment right? I don't have to issue the same kinds of php commands again on my remote server? Php artisan thus from my understanding is adding amendments to my local code base thus when I deploy such code bases I don't need to run additional php commands? do I just add laragon/php.exe to path in windows? thing is I have a different version for xampp what I use as well for other php frameworks.

0 likes
4 replies
jryd's avatar
jryd
Best Answer
Level 12

You've got multiple questions here, so let me split them out and answer them separately.

  1. PATH variable Yes, you should add the PHP exe to your PATH environment variable - this way you can run PHP from any command line from any directory on your computer. Usually it is just enough to include the folder to the PHP.exe file - as this is what happens behind the scenes:
  • you run php artisan do:something
  • your command line searches the current directory and then all the directories in the PATH environment variable for something that can interpret your command
  • it will find PHP.exe and realise that is what you are trying to run and then use that to execute your command If your PHP.exe is directly in C:/Laragon then just add that directory to your PATH variable - remember to restart any consoles to refresh the PATH variable.
  1. Artisan commands Any artisan commands you add yourself (custom artisan commands) will stay in your codebase and will be present when you deploy to production. Any artisan commands you use to create files (e.g php artisan make:controller ExampleController) will persist the files - i.e they will be present in your codebase and thus present when you deploy to production. This is to say you are correct, it will add to your local project ready for deployment - you won't need to run these again when you deploy. The only artisan commands you may need to run when you deploy live are ones to set the environment up, e.g:
  • php artisan migrate
  • php artisan key:generate etc...
1 like
SomeT's avatar
Level 1

Very good answer, many thanks, I think the only solution I can think of in terms of using two php.exe in the path one from xampp (although not using laravel on this) and one from laragon, is to literally add both of them to the path, in Windows I know it selects them in order of sequence, so if I mostly do laravel development then it makes sense to put the laragon php.exe first I think.

Bit strange you have to run:

php artisan migrate

on the production/remote server end of things, I don't really understand as of yet why you would have to do that for example, for an SQL database?

1 like
jryd's avatar

Well php artisan migrate runs any database migrations you have.

If you are deploying to production for the first time then you won't have a database setup already and so you need to run this to get everything setup.

Down the line if you already had a production database and were just migrating to a new server then you probably wouldn't run this, as you would just backup the old database and restore it on your new server.

1 like
SomeT's avatar
Level 1

Thanks, I will look into all this eventually.

1 like

Please or to participate in this conversation.