Trying to deploy a website returns error
Service ID: 643c8ee2-66dc-413e-bcca-2d08a9c73466
Hi!! I'm trying to deploy a web app to railway. Sorry if I say something wrong but this is my first time working with websites. We have a website written in http, css, php and javascript which i loaded on github but trying to deploy it on railway I get the error:
"
context: f62c7b62599d441440438a1ad86d113c
Nixpacks build failed
Nixpacks was unable to generate a build plan for this app.
Please check the documentation for supported languages:
https://nixpacks.com
The contents of the app directory are: b
ootstrap/
Login/
Registrazione/
Errore/
SQL/
Home/
Images/
PHP/
Utenti/
"
I'll leave the file structure of the project.
Thanks in advance for the help!
Getting Started | Nixpacks
App source + Nix packages + Docker = Image
54 Replies
Project ID:
643c8ee2-66dc-413e-bcca-2d08a9c73466
php files should be inside an app directory, what framework is this?
It should have been written without any framework (not by me) 🤔
okay well usually site files for a php project go into an app directory
Ok, so should I move every file and directory into a root folder called app?
Or simply put every php file into an app folder?
yeah i assume so, thats the folder railway will use
wait sorry the first or the second? 😅
oh sorry, just the php files for the website
Hi, thanks for the tips! I've tryed to put all of the php code inside an app directory like in the image. Now the deployment goes on for longer but still returns the same error as before !
can you send me a link to your repo?
GitHub
GitHub - AlbertoNoris/MPP: test website
test website. Contribute to AlbertoNoris/MPP development by creating an account on GitHub.
This is a new repo that I've built in order to make it public so the previous projectID doesn't match
that's fine, I can't do anything with a project id anyway
ahahah ok
whats with the capital letters on the index files?
I'm used to camel case
you should only have a sinlge index file named index.php
Ok, working on it
$dbconn = pg_connect("host=localhost port=5432 dbname=Intersection user=postgres password=BIAR")
thats also not gonna work on railwayFor test porpouses do you reccomend removing it?
that would just cause more errors
Thanks again I'm gonna try it tomorrow!
Ok so I've put every file inside the app folder, created only one file with the name "index" and fixed the connection to the postgre databse by connecting it to a railway deployd postgre database. But while the website locally on my machine runs fine when I deploy it on railway I can only see one (broken) page and when I try to click on a new page of the website it returns "file not foud" https://intersection-production.up.railway.app/ . Do you have any tips? Maybe the structure of the folders are still wrong? It seems like the website cannot find the other pages but I cannot figure out how to fix it! Thanks in advance!!
Intersection
Intersection between professionals and companies site
um, you are using your database password in plaintext
thats not the main issue, but its something you should fix asap
Yeah I know I'll fix it asap but first I wanted to at least see the website running!
so in the root of your repo you have a WebSite folder, but in the root you should have the app folder, so bring your app folder into the root of the project then place all asset folders into a single asset or static folder
at this point it's just a matter of correct folder structure
You have to forgive me but I still don't get what I should do.
1. Thanks for the tip about hiding the passwords now they are hidden.
2. "in the root you should have the app folder, so bring your app folder into the root of the project" since the repo cotains also other folders which are not specific to the website can I just change the root directory in the settings of my deployment?
3. "then place all asset folders into a single asset or static folder" do you mean that I need to put all of the folders inside of /app ? Right now this is the structure:
I had to change the repo which now must be private so I cannot share it here but if you need anything just ask me and I'll send everything!
btw thanks for the help and sorry if this stuff is trivial but I'm dying for this deplyment!!
Just to be clear now the error is simply that the website doesn't work properly ( take a look here: https://website-production-39ee.up.railway.app/ ) wheares on my local machine the pages are all working properly!
Intersection
Intersection between professionals and companies site
you are setting the root directory to be /app, try just /WebSite
If i try just /WebSite It fails
your folder structure is just so un-orthodox, railway doesn't know what to make of it
I don't even know how you managed to run it locally
Ok I fixed it by simply putting everything inside the app folder
didn't I say to do that a while ago?
Yeah but you were suggesting only the php files
But no prob we figured it out
I should have tried eralier
yeah my bad, I don't have any experience with php
glad you got it solved though
Hi! I still have some issues 😅 I'm trying to create a new file by doing file_put_contents($nameOfFile, $contentsToPutInsideFile); as usual in local everything works fine but when deployed I get the error "file_put_contents(): failed to open stream: permission denied" which looks like it should only be an error caused from permissions. But every forum I found online only talks about using the command line which from railway I don't have access to. For example a possibility was doing "chmod -R 777 /app" which I tried putting inside the Start Command of the deployment which results in the website deploying correctly on the railway page but on the website a text with "Server Error" is displayed.
any tips? the app one was perfect and helped me going forward a lot!
I have seen our php guy say something about using a /storage folder?
apparently that folder is available and has the correct perms, but I might be making that up lol
I've tried but no luck unfortunately 😦 it still looks like I need to give write permission somehow
@aleks please advise? 🙏
You're using
/app/storage
?Fixed it!! Yeah it was the storage folder missing 😅
I still have one last issue and then I should be ready to have it public to the internet! Javascript seems to not work properly when deployed but it's fine on local. [what it should do]: in local when a user is registering we check if it has inserted the email after having pressed an "invia" (it means register) button. If the email hasn't been inserted a red box comes up under the text field in which you insert the email [what it does]: when deployed the red box comes up as soon as the page is loaded and not after the button has been pressed.
I leave the file that containts the javascript and 2 images that should explain better wht's the error ... thanks as always for the help!! 💪💪💪
will take a crack at that when I have some time
whats the railway domain that your app is running on
Intersection
Intersection between professionals and companies site
look at the browser console errors for that registration page, fix the super simple console errors and your problem will be solved
so that means use this link to load jquery lib instead of the google based link
https://code.jquery.com/jquery-3.6.0.min.js
Looking into it! 👀
No errors but now the error codes never show themselves even when the button is pressed
I replaced it like this
yes
looks good
No ok I need to try again because now also in local it doesn't show
lol