How to Install New Relic on my php application?
I am running a php web application and I would like to track error in my new relic dashboard, how do I do that? Because it seems like I need access to the
php.ini
Solution:Jump to solution
for ease of use, you would want to use a Dockerfile so that it's easy to copy in your own php.ini into the container.
24 Replies
Project ID:
b01880bc-a5fa-4f41-b977-800d4b3367ef
b01880bc-a5fa-4f41-b977-800d4b3367ef
Solution
for ease of use, you would want to use a Dockerfile so that it's easy to copy in your own php.ini into the container.
Can I still use nixpacks?
nope, nixpacks and a Dockerfile are separate things
umm sorry, but what's the difference between nixpacks and Dockerfile?
nixpacks tries to determine the app and what the app needs to run and builds an image automatically for you (or for railway in this case)
a Dockerfile is a text file with what is essentially just a list of commands that you write yourself, that tell the builder how to build an image and run your application.
you will get far more flexibility out of a Dockerfile than you would nixpacks. since you then control nearly everything that's run during build.
ahh, so if I have Dockerfile it will not run nixpacks anymore right?
that's correct, it's either one or the other
there would be absolutely no shortage of examples for Dockerfiles that run php apps with a modified php.ini file, and since Dockerfiles are in no way exclusive to Railway, so as long as you follow some best practices you'll have what you need up and running in no time
Because I kinda developed my application using the nixpacks way, so if I have to write Dockerfile myself then I'll have to figure a lot of things
like I said, it's essentially a file with a list of commands that tell the builder what to run during build and how to run your app, as long as you understand the php ecosystem you will have no difficulties
watch some YouTube videos, read some articles, look at some examples, you'll pick it up in no time!
Alright Ill check it out
sounds good!
Thanks for the encouragement, Imma spend my night playing with docker
happy to help!
Um a little bit more help, here's my dockerfile
Now it works on my PC when I use
docker run --env-file .env -p 8080:80 my-php-nginx-app
, but it doesn't work when I run on railway
@Brody really need your help 😠Now the issue is it's serving the nginx example page rather than my actual website, but whenever I try running the docker in my PC it's working perfectly. What could be the issue?you need to copy your site files into the location of the serve folder
Custom php.ini in nixpacks will come hopefully soon, I'll do it when I have any free time
yay niceee
So probably in a couple weeks 😅
Copied, here's my Nginx config file:
Now I have to add
PORT
variable into my deployment and in the docs mentioned its not recommended to do so. But whenever I try using variable like ${PORT}
it doesnt work. How do I fix it?
No worries, it will helps in my future project, I already started writing DockerFile :Dnginx does not provide a native way to listen on the PORT environment variable, for this you will have to set a static port in your nginx config file and in the service variables
Ahh okay
I got my application up and running, how do I install New Relic?
have you followed their docs