Path contents missing with Request object using Herd When using Herd with a generic PHP project, the path properties of the Request object are not getting filled.
$request = new Request;
$step = $request->segment(1);
When I call /setup/validate, nothing is getting filled and the segments are all empty (I did a var dump on it)...in fact most of the request object isn't filled.
I'm new to Herd and want to use it instead of Docker.
Any help would be appreciated!!
Thanks!
Normally, Herd is used for Laravel.
Beginners shouldn't try something difficult right away.
No one can answer a question without knowing what a "Request" is.
No one writes new Request in Laravel.
@puklipo
That was a completely useless reply.
The fact that you don’t know what a “Request” object is in the context of a web application strongly suggests that you’re probably the beginner.
I’ve found tons of examples with “new Request”.
Don’t worry, though. This “beginner” with over 40 years of SW experience wrote a LocalValetDriver and fixed the problem on his own.
You should stick to replying to posts that you have an actual constructive answer to.
I suggest just setting up a regular apache or nginx server.
@jlrdw that kind of defeats the purpose of using Herd.
Adding a LocalValetDriver fixed the problem.
Have you tried just dumping the request super global?
$_REQUEST
@jlrdww yes I did…it was empty except for the Session ID.
I fixed the problem by setting up a LocalValetDriver.
@TSDeveloper I did a test, and the request is empty unless you send something in it, but the server super global isn't.
$_REQUEST
/Users/tray2/Herd/crap/index.php:3:
array (size=0)
empty
$_SERVER
/Users/tray2/Herd/crap/index.php:5:
array (size=37)
'USER' => string 'tray2' (length=5)
'HOME' => string '/Users/tray2' (length=12)
'HTTP_ACCEPT_LANGUAGE' => string 'sv-SE,sv;q=0.9,en-US;q=0.8,en;q=0.7' (length=35)
'HTTP_ACCEPT_ENCODING' => string 'gzip, deflate' (length=13)
'HTTP_ACCEPT' => string 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7' (length=135)
'HTTP_USER_AGENT' => string 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36' (length=117)
'HTTP_UPGRADE_INSECURE_REQUESTS' => string '1' (length=1)
'HTTP_CACHE_CONTROL' => string 'max-age=0' (length=9)
'HTTP_CONNECTION' => string 'keep-alive' (length=10)
'HTTP_HOST' => string 'crap.test' (length=9)
'PATH_INFO' => string '' (length=0)
'REDIRECT_STATUS' => string '200' (length=3)
'HERD_HOME' => string '/Users/tray2/Library/Application Support/Herd' (length=45)
'SERVER_NAME' => string 'crap.test' (length=9)
'SERVER_PORT' => string '80' (length=2)
'SERVER_ADDR' => string '127.0.0.1' (length=9)
'REMOTE_PORT' => string '60791' (length=5)
'REMOTE_ADDR' => string '127.0.0.1' (length=9)
'SERVER_SOFTWARE' => string 'nginx/1.25.4' (length=12)
'GATEWAY_INTERFACE' => string 'CGI/1.1' (length=7)
'SERVER_PROTOCOL' => string 'HTTP/1.1' (length=8)
'DOCUMENT_ROOT' => string '/Users/tray2/Herd/crap' (length=22)
'DOCUMENT_URI' => string '/Applications/Herd.app/Contents/Resources/valet/server.php' (length=58)
'REQUEST_URI' => string '/' (length=1)
'SCRIPT_NAME' => string '/index.php' (length=10)
'SCRIPT_FILENAME' => string '/Users/tray2/Herd/crap/index.php' (length=32)
'CONTENT_LENGTH' => string '' (length=0)
'CONTENT_TYPE' => string '' (length=0)
'REQUEST_METHOD' => string 'GET' (length=3)
'QUERY_STRING' => string '' (length=0)
'FCGI_ROLE' => string 'RESPONDER' (length=9)
'PHP_SELF' => string '/' (length=1)
'REQUEST_TIME_FLOAT' => float 1728404027.9123
'REQUEST_TIME' => int 1728404027
'argv' =>
array (size=0)
empty
'argc' => int 0
'HERD_SITE_PATH' => string '/Users/tray2/Herd/crap' (length=22)
And that is quite normal
I have the exactly same problem, also the PUT requests cannot be send,
What is the purpose of Laravel Herd then when it make you more problems ?!??!!?
Please sign in or create an account to participate in this conversation.