I compare with php -S localhost:8000 and valet start in phpinfo();
I notice that
in php -S localhost:8000 the info is display correct.
However in valet, $_SERVER['SERVER_NAME'] is empty,
and the
$_SERVER['DOCUMENT_ROOT'] /Users/shiroamada/.composer/vendor/laravel/valet
but my folder should be
/Users/shiroamada/www/project1
is it a bug or any configure need to be done?
+1 Also having problems with $_SERVER, where should I define them??? Docs doesn't speak about it
ALTERNATIVE with Caddy in use:
In the fastcgi block of ~/.valet/Caddy/thesite.dev is where I add env variables which I need to be specific for a given valet site:
fastcgi / 127.0.0.1:9000 php {
index server.php
env VARNAME varValue
}
... which then can be accessed in numerous ways ... one of which is:
$foo = getenv('VARNAME'); // which causes $foo to be assigned 'varValue'
I have only one thesite.dev for all my sites inside Sites folder, should I create the file with my site name?
How should I reboot my server after that?
@drbyte Tx for your help
I'd use the valet link command:
cd ~/Sites/projectname
valet link projectname
Then edit the ~/.valet/Caddy/projectname.dev file as I mentioned above.
Repeat for each site that needs the special treatment.
If you run valet secure for a given project you may need to redo the edit.
I suppose you could edit the valet Caddyfile and SecureCaddyfile stubs, but they will change when you update.
Fortunately once you've got things set, if you're not running link and unlink and secure and unsecure then you won't need to re-edit the *.dev files.
some of the info should be auto generated not by user defined.
Eg. $_SERVER['SERVER_NAME'] and $_SERVER['DOCUMENT_ROOT'] . PHP should be able to pick up the info from the server.
I also have the problem that the $_SERVER['Document Root']-Variable is linked to the valet file and not representing the actual folder / path where the files are.
For my app , written in CakePHP, I need to have a proper $_SERVER Variable in order to upload files to the app.
Upgraded to version 2.0.1 these issue was fixed.
when upgrading to that version my websites are not running anymore. I receive the 502 Error.
Using version 2.0.3 and this is still an issue.
Under homestead, $_SERVER['SERVER_NAME'] is correct
Under Valet, it's empty
Most helpful comment
Using version 2.0.3 and this is still an issue.
Under homestead, $_SERVER['SERVER_NAME'] is correct
Under Valet, it's empty