Build PHP 7.3 with Laravel. How can i do it?
I have an old application. How can i make build in service?
131 Replies
Project ID:
N/A
N/A
Project ID: N/A
You would need to write a Dockerfile to use unsupported php versions
Okay. I need a Dockerfile.
Have a application, but i have questions about how make it.
Can send me?
@Thomas Mendonça are you brazilian? if so, do you mind upvoting this community suggestion ? Bora trazer o Railway pro Brasil 😉
Also, I'll send you a dockerfile example
Do you use Composer or Artisan?
Both
Yeah!! I am Brazilian ❤️
I need composer run my Laravel project
Ok, one sec
Okay
This is my dockerfile using php 7.4 and composer
default.conf
supervisor.conf
this is also an old project, lol
It just doesn't has artisan
Okay
I will try here
Need I to config something in Railway settings?
you shouldn't have to
okay
Error 😢
full build logs please - https://bookmarklets.up.railway.app/log-downloader/
change
php:7.4-fpm
to php:7.3-fpm
There's some incompatibilities between the two
Okay, one sec
error
build logs again please
There is, my bro
im not the php guy, you will have to wait for a response from medim, please be patient as this is community support
replace it to
php:7.3-fpm-alpine
i'm wondering if docker-ext exists in php:7.3-fpm
by default 🤔
im sure the alpine one does thookay, one sec
haha no problem, I will wait.
thanks for you help
hehe fail again
:"(
going forward, please only send the logs you get from the bookmarklet, the screenshots are not very helpful
alpine doesn't has apt-get lmao
wait a sec
Ow, okay.
one sec, i'm redoing the dockerfile to be alpine based
let's see the next error lmao
(it prob won't gonna find one of those packages since i migrated debian to alpine-linux)
ok
one minute
💀
what is weird is that it runs the docker-php-ext in line 21 but no the one that configures gd
you can try removing that line entirely if your app doesn't rely on gd
or try changing it to
okay
what's gd?
Image manipulation
Ah okay
one sec
whitespaces?
^
tbh just remove that entire line
if its needed we'll find a way to add it
lets get that app up first
Okay
almost there, lol
hehe
yeah
more one
it installs from source, we need git
RUN apk update && apk add --no-cache again?
twice?
edited it, forgot to remove that line
ah
okay
also, do you got the
default.conf
and supervisord.conf
at the same dir level as your dockerfile?yes, i do
building...
yeah it needs gd
lmao
Oh God
And now?
re added GD with some php 7.2 args
this help thread made my remember my hate for php in prod
also, good thing railway doesn't charge build time
Yeah hehe
So good
error
you are using a github repo as package in composer
hmm..
okay
i will remove
one minute
is it needed?
seems like its a private repo
and its a hassle since you would need to generate SSH keys just to clone them with composer but its a bad idea to upload your SSH keys to your repo so you would need repo secrets... so lets avoid all that
i will remove, it is trash
..did it build?
build complete
but don't show the default page
prob some nginx config
I how put "/public"?
to publish
@Brody I set a 8080 port in my server.listen so I guess he would need to add a PORT=8080 env var?
.
@Thomas Mendonça create a PORT=8080 env var
Oooh
this is the problem
!!
we may need to mess a bit with the default.conf now, since I use that specific config to fastcgi
one minute
i will set port
ah fail
no errors
just wait
try refreshing it
i do it
:thonking:
can you send the url here?
Thomas, where did you set the env var
(I also think there's some issues with the default.conf)
would you mind answering this question
can you please answer the question
Did u set it in the Railway Env tab or locally?
in the railway system variables
Railway env tab
Railway env tab
@Brody would it be too hard to migrate from nginx to caddy?
if you where familiar with the technologies involved, no
try this default.conf
laravel serves in the /public folder
saw you mentioning it, I forgot about that
Okay
Building...
One minute
nothing yet
"fastcgi_pass 127.0.0.1:9000;"
Is it right?
Anything in the logs?
yes.
I'm out of ideas :PepeCRY:
we got it to build and deploy but I suck at nginx
Ahh :/
So close
https://laravel.com/docs/11.x/deployment#nginx
we can try the default conf from laravel docs
okay
One minute
That's normal, just supervisord starting things up
Yeah
But same page
Application failed to respond
https://nepscoin-sistema-production.up.railway.app/
:sadcat:
ô sufoco
very difficult
I was set this default.conf
Now is play life
Now is the problem
English only please
Sorry
Someone help me?
U are now listening to port 80
So that env var u set at railway should also be 80 but if it works I guess u alrady did that
But seems like file serving is still a bit off since it says 404
Is it an API? you can try doing a request to it
Yeah, railway service on port 80
env
Web but not API
I managed to find an error on port 9000, already in use. With this information, can you help me with any solution tips?
Its already in use by the fastcgi
oh nvm, u changed it to 80
fastcgi port can't be the same as your listen port afaik, so put like listen on 80 and fastcgi port on a number > 1000
and what did u do to hit that error?
maybe that was the error this entire time, try changing it to like 8080, also you cannot use fastcgi as a unix socket, last time I used it like this on railway it wouldn't work pecause of specific perms.
it needs to be on a port
@Thomas Mendonça
send ur default.conf here for me to edit it
just change the listen to
listen 80;
(also change the env var in railway to 80)i'm trying run local
not success
can you analize, please?
that default conf won't work locally
that's railway specific
the same problem, if run docker local, run in railway
to run locally:
change
server_name
to localhost
to run on railway:
change server_name
to 0.0.0.0
Aah okay
But the nginx, the same is error?
404?
yeah
not found the app
yeah, I don't know what to do anymore lmao
okay
one minute
i will try
Hey idk if this will help at allll BUT i also use laravel on railway and these are my build cmds
its under Custom Build Command
and just put this in
i dont use any form of changes than those cmds, no custom railway conf or anything
Okay
What's PHP version?
@Faith
its 8.2, it auto does it
im using nixpacks
Good
Mine 7.3
😢
Knows someone how run PHP 7.3?
a guy further up gave a composer with 7.3 try his
im try all
nothing that solved
Guys, I come to you to let you know that it worked!
It was difficult, but I managed to solve it. If you want, I'll put the 3 files here.
I am very grateful to those who helped me and spent time working with me to resolve it. A special hug to @Medim , who was great!
Share them here @Thomas Mendonça
So I can see what I missed