Hey guys,
I've worked away today trying to get Flarum working on my local dev machine - Mac/OsX/Valet.
My project website is in the root directory and flarum is in /myproject/discuss
I've set up a valet driver and made some modifications to make it work as I think it should. After much stuffing around, I could actually run "php flarum install" from the command line, but nothing works when browsing to http://myproject.dev/discuss
To begin with, Chrome would return an error: ERR_CONTENT_LENGTH_MISMATCH
Since running "php flarum install" from the command line, it doesn't throw an error - Chrome just sits there spinning away waiting for Flarum to do something (which it never does - blank screen)
Here is my FlarumValetDriver.php
<?php
class FlarumValetDriver extends ValetDriver
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
*
* @return bool
*/
public function serves($sitePath, $siteName, $uri)
{
return strpos($uri,'/discuss') && is_dir($sitePath.'/discuss/vendor/flarum') && file_exists($sitePath.'/discuss/flarum');
}
/**
* Determine if the incoming request is for a static file.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
*
* @return string|false
*/
public function isStaticFile($sitePath, $siteName, $uri)
{
if ($this->isActualFile($staticFilePath = $sitePath.$uri)) {
return $staticFilePath;
}
return false;
}
/**
* Get the fully resolved path to the application's front controller.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
*
* @return string
*/
public function frontControllerPath($sitePath, $siteName, $uri)
{
if (strpos($uri,'/discuss/admin') === 0) {
return $sitePath.'/discuss/admin.php';
}
if (strpos($uri,'/discuss/api') === 0) {
return $sitePath.'/discuss/api.php';
}
return $sitePath.'/discuss/index.php';
}
}
Has anyone got Valet serving up Flarum from a subdirectory? Please help!