Skip to content

Instantly share code, notes, and snippets.

@shealavington
Last active August 9, 2019 10:58
Show Gist options
  • Save shealavington/92f95265d34286110d3f8fd850c9b1b9 to your computer and use it in GitHub Desktop.
Save shealavington/92f95265d34286110d3f8fd850c9b1b9 to your computer and use it in GitHub Desktop.
Troubleshoot Directus by adding this as a custom extension. See if you've missed any of the requirements.
<?php
use Directus\Application\Http\Request;
use Directus\Application\Http\Response;
return [
'' => [
'method' => 'GET',
'handler' => function (Request $request, Response $response) {
// Simple GET endpoint example
return $response->withJson([
'data' => [
// Other things to check: mod_rewrite, mysql_version, http_server
'php_version' => [
'status' => phpversion() >= 7.1 ? true : false,
'title' => 'PHP Version',
'description' => 'Directus requires PHP 7.1+, though we recommend using the most recent/stable version possible.'
],
// Directory Permissions
'logs' => [
'status' => is_writeable('../logs'),
'title' => 'Logs Directory',
'description' => 'The logs directory should have write permission'
],
'uploads' => [
'status' => is_writeable('./uploads'),
'title' => 'Uploads Directory',
'description' => 'The logs directory (/public/uploads) should have write permission: (or your configured upload directory)'
],
// Extensions
'pdo' => [
'status' => extension_loaded ('pdo'),
'name' => 'pdo + mysql',
'description' => 'PHP Data Objects (PDO) enables safer parameterized queries'
],
'curl' => [
'status' => extension_loaded ('curl'),
'name' => 'cURL',
'description' => 'cURL fetches metadata (eg: title and thumbnail) from embed services like YouTube and Vimeo'
],
'gd' => [
'status' => extension_loaded ('gd'),
'name' => 'GD Library',
'description' => 'GD allows the Thumbnailer to generate images. To add thumbnail support for SVG, PDF, PSD and TIF/TIFF you must also install the imagick extension.'
],
'fileinfo' => [
'status' => extension_loaded ('fileinfo'),
'name' => 'fileInfo',
'description' => 'Fetches metadata (eg: charset and file-type) and IPTC Info (eg: location and keywords) for uploaded images.'
],
'mbstring' => [
'status' => extension_loaded ('mbstring'),
'name' => 'mbstring',
'description' => 'The multibyte string functions helps php to work multibyte encoding. These functions are used by Directus to get the correct string\'s length or a correct comparison with another string.'
],
'xml' => [
'status' => extension_loaded ('xml'),
'name' => 'xml',
'description' => 'Used by PHPUnit (Only required if you are installing PHPUnit)'
],
]
]);
}
],
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment