Run php Artisan in a different directory

Asked

Viewed 182 times

0

How to execute the command:

php artisan ...

In a different directory so that the generated files stay in the folder I set

1 answer

0


This will depend on the command you want to run, but let’s assume that you want to run a migration, you can define the path(Way) in this way:

php artisan migrate --path=/app/database/migrations/relations 

Source

1 - Remembering that you must be inside directory where the file is Artisan
2 - And the executable of php must be included in the environmental variables

But if you want to run the command in another folder, set the complete path of each file, for example:

c:\bin\php.exe c:\meu_projeto\artisan migrate --path=c:\meu_projeto\migrations

In the example, my php executable is in the "bin" folder at the root of c:, while my project is in the folder "meu_projeto" and within "meu_projeto" as migrations.

This generates a lot of work, so it is preferable to enter the folder where this the file artisan and put the php executable in the variables of ambience.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.