configure php.ini laravel

agentaldo
PRO

7 months ago

Hi, I would like to know where I can see the php.ini file settings and how I can adjust changes, for example being able to change these values

post_max_size = 30M

upload_max_filesize = 30M

max_execution_time = 300

thanks

Awaiting User Response

9 Replies

7 months ago

Hello, we are going to be working on an easy way to do this and will let you know on update regarding that.


railway[bot]

7 months ago

An internal ticket has been attached to this thread. Updates will be relayed in this thread, so keep an eye out!

Status changed to In Progress railway[bot] 7 months ago


brody

Hello, we are going to be working on an easy way to do this and will let you know on update regarding that.

agentaldo
PRO

7 months ago

Thanks, but while they are working on that easy way to do it, how can I do it now?, since I need to increase those 3 variables in php.ini


Status changed to Awaiting Railway Response railway[bot] 7 months ago


7 months ago

There is not an easy way short of writing your own Dockerfile and copying in your own php.ini file to the correct location.


Status changed to Awaiting User Response railway[bot] 7 months ago


7 months ago

For the moment, you should be able to configure it with Nginx, actually; make a file in your project called nginx.template.conf, copy the contents of this file in, and add some PHP_VALUE parameters.


Status changed to Awaiting Railway Response railway[bot] 7 months ago


unicodeveloper
PRO

7 months ago

Hi @agentaldo, have you tried @aleks approach?


Status changed to Awaiting User Response railway[bot] 7 months ago


aleks

For the moment, you should be able to configure it with Nginx, actually; make a file in your project called nginx.template.conf, copy the contents of this file in, and add some PHP_VALUE parameters.

agentaldo
PRO

7 months ago

Thanks for your reply, should I create the nginx.template.conf file in the root of my app or in a specific directory? Does Railway automatically take the configuration from the file in the deploy or should I do some other configuration?


Status changed to Awaiting Railway Response railway[bot] 7 months ago


unicodeveloper
PRO

7 months ago

Create it in the root of your app and Railway will automatically detect it from there.


Status changed to Awaiting User Response railway[bot] 7 months ago


agentaldo
PRO

6 months ago

Thanks to @aleks @unicodeveloper
The solution was to create the nginx.template.conf file in the root of the app as @aleks and @unicodeveloper say

I made some changes and it ended up like this:

------------------------------------------------------
worker_processes 5;

daemon off;

worker_rlimit_nofile 8192;

events {

worker_connections 4096; # Default: 1024

}

http {

include $!{nginx}/conf/mime.types;

index index.html index.htm index.php;

default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] $status '

'"$request" $body_bytes_sent "$http_referer" '

'"$http_user_agent" "$http_x_forwarded_for"';

access_log /dev/stdout;

error_log /dev/stdout;

sendfile on;

tcp_nopush on;

server_names_hash_bucket_size 128; # this seems to be required for some vhosts

server {

listen ${PORT};

listen [::]:${PORT};

server_name localhost;

$if(NIXPACKS_PHP_ROOT_DIR) (

root ${NIXPACKS_PHP_ROOT_DIR};

) else (

root /app;

)

add_header X-Frame-Options "SAMEORIGIN";

add_header X-Content-Type-Options "nosniff";

index index.php;

charset utf-8;

# Configuración para aumentar el tamaño máximo permitido

client_max_body_size 10M;

proxy_connect_timeout 300;

proxy_send_timeout 300;

proxy_read_timeout 300;

fastcgi_send_timeout 300;

fastcgi_read_timeout 300;

$if(IS_LARAVEL) (

location / {

try_files $uri $uri/ /index.php?$query_string;

}

) else ()

$if(NIXPACKS_PHP_FALLBACK_PATH) (

location / {

try_files $uri $uri/ ${NIXPACKS_PHP_FALLBACK_PATH}?$query_string;

}

) else ()

location = /favicon.ico { access_log off; log_not_found off; }

location = /robots.txt { access_log off; log_not_found off; }

$if(IS_LARAVEL) (

error_page 404 /index.php;

) else ()

location ~ \.php$ {

fastcgi_pass 127.0.0.1:9000;

fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;

include $!{nginx}/conf/fastcgi_params;

include $!{nginx}/conf/fastcgi.conf;

# Configuración de PHP_VALUE

fastcgi_param PHP_VALUE "

post_max_size=10M

upload_max_filesize=10M

max_execution_time=300

max_input_time=300

";

}

location ~ /\.(?!well-known).* {

deny all;

}

}

}


Status changed to Awaiting Railway Response railway[bot] 7 months ago


Status changed to Solved brody 7 months ago


railway[bot]

4 months ago

Update: An internal ticket linked to this thread has been changed to Canceled.

Status changed to Awaiting Railway Response railway[bot] 4 months ago


4 months ago

We now have much better php support via railpack: https://railpack.com/languages/php


Status changed to Awaiting User Response railway[bot] 4 months ago


configure php.ini laravel - Railway Help Station