devilbox
devilbox copied to clipboard
[Howto]: Fix 504 Gateway Timeout Apache 2.4 Xdebug php-fpm 8.1
Have you already checked elsewhere?
- [X] I have read the Devilbox documentation
- [X] I have checked the Devilbox Troubleshooting Guide
- [X] I have checked the Devilbox FAQ
- [X] I have checked the Devilbox Howto
- [X] I have checked the Devilbox Forum
- [X] I have checked existing issues
- [X] I have googled already with no luck
- [ ] I have not done any of the above
What are you struggling with?
php debugging with xdebug times out with a 504 error, the apache error is like this:
[Thu Feb 09 08:18:00.092961 2023] [proxy_fcgi:error] [pid 1336:tid 140455015693112] (70007)The timeout specified has expired: [client 172.16.238.1:38376]
I have seen this suggestion: https://stackoverflow.com/a/65935475/1533148 about putting this in the php fpm conf file so I guess cfg/php-fpm-8.1/devilbox-fpm-conf: FcgidIdleTimeout 1200 FcgidProcessLifeTime 1200 FcgidConnectTimeout 1200 FcgidIOTimeout 1200
but when I try that it causes an error and devilbox can't be started
What have you tried already?
I have custom configs for php-fpm-8.1 like this:
; ############################################################
; Devilbox php-fpm.conf: Current default settings
; ############################################################
;
; Information
; -----------
; * Do not edit this file (it belongs to git)
; * This file shows example settings that are currently effective
; * If this file is enabled, nothing will change as it reflects the current default settings
;
; How to enable?
; --------------
; * Copy this file to another file with ".conf" extension
; * Only files with ".conf" extensions will be applied by PHP-FPM
; ###
; ### PHP-FPM global settings
; ###
;
[global]
; Error log level. Possible values: alert, error, warning, notice, debug. Default value: notice.
log_level = notice
; ###
; ### Pool configuratoin
; ###
[www]
; The timeout for serving a single request after which the worker process will be killed.
; This option should be used when the 'max_execution_time' ini option does not stop script
; execution for some reason.
request_terminate_timeout = 0
; A maximum of backlog incoming connections will be queued for processing.
; If a connection request arrives with the queue full the client may receive an error with an
; indication of ECONNREFUSED, or, if the underlying protocol supports retransmission,
; the request may be ignored so that retries may succeed.
; This should not be greater than `cat /proc/sys/net/core/somaxconn`, otherwise connections
; are silently truncated
listen.backlog = 1024
; static - the number of child processes is fixed (pm.max_children).
;
; dynamic - the number of child processes is set dynamically based on the following directives:
; pm.max_children, pm.start_servers, pm.min_spare_servers, pm.max_spare_servers.
;
; ondemand - the processes spawn on demand (when requested, as opposed to dynamic, where
; pm.start_servers are started when the service is started.
pm = ondemand
; The maximum number of child processes to be created
pm.max_children = 50
; The number of child processes created on startup. Used only when pm is set to dynamic.
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2.
pm.start_servers = 4
; The desired minimum number of idle server processes.
pm.min_spare_servers = 2
; The desired maximum number of idle server processes.
pm.max_spare_servers = 6
; The number of requests each child process should execute before respawning.
; This can be useful to work around memory leaks in 3rd party libraries.
; For endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
; Default value: 0.
pm.max_requests = 500
; The number of seconds after which an idle process will be killed. Used only when pm is set to ondemand
pm.process_idle_timeout = 1000s
; vim: set ft=dosini:
php-ini-8.1/php.ini like this:
; ############################################################
; # Devilbox php.ini: Xdebug example
; ############################################################
;
; Information
; -----------
; * Do not edit this file (it belongs to git)
; * This file show a possible Xdebug example configuration
; * If this file is enabled, it will overwrite the current Xdebug settings
;
; How to enable?
; --------------
; * Copy this file to another file with ".ini" extension
; * Only files with ".ini" extensions will be applied by PHP
;
; PHP.ini configuration
;
[PHP]
; Xdebug
; https://3.xdebug.org/docs/upgrade_guide
; Use these settings to enable Xdebug for PHP
; Make sure to read up on Xdebug some settings might significantly slow down requests.
; The following is just an example configuration and should be adjusted
; Defaults
xdebug.mode = debug
;xdebug.remote_handler = dbgp
;xdebug.start_with_request = yes
xdebug.scream = off
; How to connect
xdebug.client_port = 9003
xdebug.client_host = 192.168.1.67
xdebug.discover_client_host = false
; Logging
; xdebug.log = /var/log/php/xdebug.log
; xdebug.log_level = 7
; IDE Configuration
xdebug.idekey = PHPSTORM
;xdebug.idekey = VSCODE
; vim: set ft=dosini:
max_input_time = 0
max_execution_time = 0
error_reporting = E_ALL & ~E_DEPRECATED
xmlrpc_errors = Off
report_memleaks = On
display_errors = On
display_startup_errors = On
html_errors = On
What is your goal?
not timeout