Trying to override php.ini through Dockerfile (Laravel)

yahavHOBBY

a year ago

TL;DR - What's the best way to override php.ini 'upload_max_filesize' on a deployed Laravel app here on railway?

php 8.1

In my deployed Laravel app, I'm trying to override php.ini 'upload_max_filesize' which by default set to 2MB

On local env I'm successfully doing that by adding 'custom-php.ini' file contains:

[PHP]upload_max_filesize = 100M

And adding to my Dockerfile:

COPY ../docker/custom-php.ini /etc/php/8.1/cli/php.ini

COPY ../docker/custom-php.ini /etc/php/8.1/apache2/php.ini

So it places my custom php.ini file inside the container and allows Laravel app to upload files up to 100mb.

However, in my deployed app I cannot perform this action. I have notice railway gives you the option to build the app with your own Dockerfile, did that, and the app recognized the Dockerfile and choose it over NixPacks build but when it does, the build is not successful.

this is the Dockerfile I'm trying to build the app with:

FROM montebal/********* as production

COPY ../vendor /var/www/html/vendor

COPY ../docker/custom-php.ini /etc/php/8.1/cli/php.ini

COPY ../docker/custom-php.ini /etc/php/8.1/apache2/php.ini

The problem here is that railway does not support compose file at the moment so I cannot build the entire app properly with all the needed ports for the app to listen to (as I able to do locally) I guess my bottom line question is if there is a better way to override php.ini file on my Laravel app deployed here on railway, maybe some run command or something I'm missing?

Thanks a lot to everyone.