Need Help Migrating to Laravel: Stuck on Database Error!
I've recently discovered the Laravel ecosystem for website development, and I'm completely sold on it. My journey with website development has been quite confusing, especially because I'm not a fan of the modularity of JavaScript. I constantly have to find new tools that are not standardized, and I dislike having to guess which micro-services to use when developing new features like emails, forms, etc. I wanted one platform that could address all these issues, and PHP with Laravel came to mind. Additionally, it helps me understand some PHP code used in WordPress.
Currently, I'm in the process of transferring my website to the Laravel ecosystem with MySQL, but I'm encountering an error. Here’s what I’ve done so far:
- Uploaded the project to production using the Railway Up command.
- The production project is active, but I don't see my home screen only see the error below.
- On my local machine, I’ve migrated the application to use MySQL.
- Pushed all changes to my linked GitHub account.
- Created a MySQL service and spun up a production SQL server.
- Tried connecting the variables by following this tutorial: Laravel and MySQL Deployment.
I removed the last command as it'd affected the image building and got this error:
Database file at path [railway] does not exist. Ensure this is an absolute path to the database. (Connection: sqlite, SQL: select * from "sessions" where "id" = JNOCeZwVPhRbg61Uq6ESV1xKDCejzZVrY0Bclzf2 limit 1)Keep in mind, I'm not an expert when it comes to PHP or databases, so any advice or guidance on how to resolve this would be greatly appreciated.
15 Replies
Project ID:
c25825c5-3295-4a9f-8435-a0f5139edbe4
Project ID: c25825c5-3295-4a9f-8435-a0f5139edbe4
I had a real bad feeling when you said you were moving to php given I know nixpacks support for php is not the best
Can you explain why? I've managed to transfer everything hassle-free, my only problem is deploying it to Railway. I didn't want to move to Rails or Python framework as that seemed overkill for a portfolio website.
well where do I start, do you know what nixpacks is?
Like I said I'm completely new so far and only gone over the getting started docs.
fair, do you know what docker is?
I'm aware of it and that it's a virtual container that helps separate induvial projects, but have never used it in a production setting. I'm a front-end developer learning about backend. ( I haveLess than <2 years of experience)
for simplicity sake, at its core that's what railway uses to run your app
I get that I know nothing about Docker. So I'll take a look at their documentation and see how it works through their getting started page.
As I'm genuinely puzzled at this moment.
all this to say that to have the best success deploying a php app on railway you will want to learn how to write a dockerfile for your app
Okay, that's good to know. Based on reading the documentation, I'm learning that Docker is the middleman that connects Laravel and MySQL. My mistake was shipping individual apps with no connection to production and that's why I'm getting this error.
thats not correct at all, docker is the infra that runs your app in containers
what connects your laravel app to the database is the code you write
Okay that's good to know. I'm goanna spend some time on this and see how it goes.
Thanks for the help 🙂
no problem!