I am using Laravel valet and working on getting data from API which takes more than 3 minutes to return result. Now the problem is when I use curl or get_file_contents
, I get timeout error ""504 Gateway Time-out nginx/1.23.1" in 60 seconds and no matter which ini
settings I add with code it doesn't change. So I searched how I can change nginx and PHP config settings in Laravel valet and the solution was to find the files in following directory:usr/local/etc/nginx/nginx.conf
The problem is that in my latest mac OS there is no folder called etc in usr/local diretory
. Can anyone please help me. I really want to bypass this and make it work but I cant find any solution.
I tried adding following code in PHP script to avoid changing configuration files but it didn't work and I still get timeout at 60 seconds.
ini_set('max_execution_time', 2400);
set_time_limit(900);
Also I tried using curl request with following settings:
$ch=curl_init();
$timeout=2400;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$result=curl_exec($ch);
curl_close($ch);
I just checked my valet logs and it shows following
2022/12/22 23:52:12 [error] 876#0: *2343 upstream timed out (60: Operation timed out) while reading response header from upstream, client: 127.0.0.1, server: , request: "POST /admin/ajax HTTP/1.1", upstream: "fastcgi://unix:/Users/username/.config/valet/valet.sock", host: "localsite.test", referrer: "http://localsite.test/admin/add-user"
try
Maybe it has Nginx config files folder.