What my URLs are being rewritten to:
http://dmn-analyser.dev/Users/steffen/.composer/vendor/laravel/valet/users/login
What I expected:
http://dmn-analyser.dev/users/login
The problem also occurs on a fresh CakePHP (3.4) installation. F.e. with static resources:
... href="/Users/steffen/.composer/vendor/laravel/valet/webroot/css/base.css" ...
Anyone with the same problem and/or a solution or idea?
Having the same issue. Static files also return a 404, but only arbitrarily. Tried debugging but no luck so far.
Adding the following line to CakeValetDriver in method frontControllerPath works for me:
$_SERVER['PHP_SELF'] = $_SERVER['HTTP_HOST'];
@Luceos and @ergineker: If one of you could verify it works, I will provide a pull request.
Yes that works!
Okay, after reading the documentation and some debugging, I think I found every $_SERVER variable CakePHP 3 needs and came to this solution:
public function frontControllerPath($sitePath, $siteName, $uri)
{
$_SERVER['DOCUMENT_ROOT'] = $sitePath.'/webroot';
$_SERVER['SCRIPT_FILENAME'] = $sitePath.'/webroot/index.php';
$_SERVER['SCRIPT_NAME'] = '/index.php';
$_SERVER['PHP_SELF'] = '/index.php';
return $sitePath.'/webroot/index.php';
}
I will provide a PR.
I don't understand this.
You are using CakePHP Framework but using Laravel Valet?
@ruchern: Yes, I think that's the concept behind Valet and its various drivers.
When there is a driver for your framework/application, you can run it on Valet.
And you can add your own drivers.
From the Documentation:
Out of the box, Valet support includes, but is not limited to:
- Laravel
- Lumen
- Symfony
- Zend
- CakePHP 3
- WordPress
- Bedrock
- Craft
- Statamic
- Jigsaw
- Static HTML
However, you may extend Valet with your own custom drivers.
@steffenbrand Oh I see. I actually never thought of that.
@steffenbrand Thank you ! 馃挴
You're welcome. Unfortunately I don't think my PR is going to be merged.Even if the documentation lists CakePHP as supported and it's broken without it.
Most helpful comment
Okay, after reading the documentation and some debugging, I think I found every $_SERVER variable CakePHP 3 needs and came to this solution:
I will provide a PR.