According to best practices, How do I correctly move a Laravel 10 project from one system or directly location to the other?
I have moved my project from /var/www/MYPROJECT to another system in the /var/www/html/MYPROJECT location. Is there a place where I must update the default (home/root) project location?
I checked the .env and the Laravel documentation, but do not find this information. I am getting errors due to using the old path.
The biggest issue is that the new system has a different database name and user and although I have updated the .env with the new credentials, I still get the following error:
SQLSTATE[HY000] [1045] Access denied for user 'OLDUSER'@'localhost' (using password: YES) (Connection: mysql, SQL: select table_name as
name, (data_length + index_length) as
size, table_comment as
comment, engine as
engine, table_collation as
collation from information_schema.tables where table_schema = 'OLDUSER_dbname' and table_type = 'BASE TABLE' order by table_name)
I have also tried to migrate: fresh, composer clear-cache and run php artisan serve to reset things but no success.
Any ideas?
Thanks in advance.
Because you moved the whole project may Laravel still caching old configs, please try php artisan config:clear
as well.
Another important thing you need re-create the storage symlink because you changed the project directory, please delete the old one here PROJECT/public/storage
if exists, and generate a new one.
PHP artisan storage:link
Also if your application uses task scheduling, make sure the cron entries are set up on the new server.
* * * * * cd /var/www/html/MYPROJECT && php artisan schedule:run >> /dev/null 2>&1
Those are the must important things that I usually care about when moving any Laravel project.