Skip to content

Commit 359544d

Browse files
Merge pull request #261 from tomhatzer/main
Feat: Setting php.ini values in php-fpm.conf
2 parents e1373c3 + 9902bde commit 359544d

File tree

2 files changed

+54
-3
lines changed

2 files changed

+54
-3
lines changed

docs/applications/laravel.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ pm.min_spare_servers = 4
142142
pm.max_spare_servers = 32
143143
pm.start_servers = 18
144144
clear_env = no
145+
php_admin_value[post_max_size] = 35M
146+
php_admin_value[upload_max_filesize] = 30M
145147
'''
146148

147149
"nginx.template.conf" = '''
@@ -211,8 +213,6 @@ http {
211213
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
212214
include $!{nginx}/conf/fastcgi_params;
213215
include $!{nginx}/conf/fastcgi.conf;
214-
215-
fastcgi_param PHP_VALUE "upload_max_filesize=30M \n post_max_size=35M";
216216
}
217217
218218
location ~ /\.(?!well-known).* {
@@ -269,6 +269,31 @@ stdout_logfile=/var/log/worker-inertia-ssr.log
269269
'''
270270
```
271271

272+
### Persistent php.ini customizations
273+
274+
If you want to customize settings from your php.ini file, you can easily do so by using the `php_admin_value` directive and appending them to your `php-fpm.conf` file like this:
275+
276+
```toml
277+
"php-fpm.conf" = '''
278+
[www]
279+
listen = 127.0.0.1:9000
280+
user = www-data
281+
group = www-data
282+
listen.owner = www-data
283+
listen.group = www-data
284+
pm = dynamic
285+
pm.max_children = 50
286+
pm.min_spare_servers = 4
287+
pm.max_spare_servers = 32
288+
pm.start_servers = 18
289+
clear_env = no
290+
291+
php_admin_value[memory_limit] = 512M
292+
php_admin_value[max_execution_time] = 60
293+
php_admin_value[max_input_time] = 60
294+
php_admin_value[post_max_size] = 256M
295+
'''
296+
```
272297

273298
## Deploy with Dockerfile and Nginx Unit
274299

docs/applications/symfony.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,30 @@ You might need to configure the [trusted proxy](https://symfony.com/doc/current/
4848
framework:
4949
trusted_proxies: "%env(TRUSTED_PROXIES)%"
5050
trusted_headers: ['x-forwarded-for', 'x-forwarded-host', 'x-forwarded-proto', 'x-forwarded-port', 'x-forwarded-prefix']
51-
```
51+
```
52+
53+
### Persistent php.ini customizations
54+
55+
If you want to customize settings from your php.ini file, you can easily do so by using the `php_admin_value` directive and appending them to your `php-fpm.conf` file like this:
56+
57+
```toml
58+
"php-fpm.conf" = '''
59+
[www]
60+
listen = 127.0.0.1:9000
61+
user = www-data
62+
group = www-data
63+
listen.owner = www-data
64+
listen.group = www-data
65+
pm = dynamic
66+
pm.max_children = 50
67+
pm.min_spare_servers = 4
68+
pm.max_spare_servers = 32
69+
pm.start_servers = 18
70+
clear_env = no
71+
72+
php_admin_value[memory_limit] = 512M
73+
php_admin_value[max_execution_time] = 60
74+
php_admin_value[max_input_time] = 60
75+
php_admin_value[post_max_size] = 256M
76+
'''
77+
```

0 commit comments

Comments
 (0)