beyondcode / beyondcode/laravel-self-diagnosis
Incorrect php extension parsing in Laravel Sail
- Dominant language
- PHP
- Stars
- 1.5k
- Forks
- 107
- PR merge metrics
- No merged PRs in 30d
Description
Running this package in Laravel sail returns an incorrect error message:
```
The following extensions are missing:
imagick
```
Running the following command shows that imagick is actually installed:
```cli
sail php -r 'echo "imagick is ".(extension_loaded("imagick")?"":"not ")."installed\n";'
```
Also, `sail php -m` has the following output, which includes `imagick`:
```ini
[PHP Modules]
bcmath
calendar
Core
ctype
curl
date
dom
exif
FFI
fileinfo
filter
ftp
gd
gettext
hash
iconv
igbinary
imagick
imap
intl
json
ldap
libxml
mbstring
memcached
msgpack
mysqli
mysqlnd
openssl
pcntl
pcov
pcre
PDO
pdo_mysql
pdo_pgsql
pdo_sqlite
pgsql
Phar
posix
readline
redis
Reflection
session
shmop
SimpleXML
soap
sockets
sodium
SPL
sqlite3
standard
swoole
sysvmsg
sysvsem
sysvshm
tokenizer
xdebug
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib
[Zend Modules]
Xdebug
Zend OPcache
```
I am running:
- Laravel 8.65+
- Laravel Sail 1.5+
Here is the `self-diagnosis.php` config file:
```php
[
'prod' => 'production',
'live' => 'production',
'local' => 'development',
],
/*
* Common checks that will be performed on all environments.
*/
'checks' => [
AppKeyIsSet::class,
CorrectPhpVersionIsInstalled::class,
DatabaseCanBeAccessed::class => [
'default_connection' => true,
'connections' => [],
],
DirectoriesHaveCorrectPermissions::class => [
'directories' => [
storage_path(),
base_path('bootstrap/cache'),
],
],
EnvFileExists::class,
ExampleEnvironmentVariablesAreSet::class,
// LocalesAreInstalled::class => [
// 'required_locales' => [
// 'en_US',
// PHP_OS === 'Darwin' ? 'en_US.UTF-8' : 'en_US.utf8',
// ],
// ],
MaintenanceModeNotEnabled::class,
MigrationsAreUpToDate::class,
PhpExtensionsAreInstalled::class => [
'extensions' => [
"bcmath",
"calendar",
"ctype",
"curl",
"dom",
"exif",
"gd",
"iconv",
"imagick",
"intl",
"json",
"libxml",
"mbstring",
"mbstring",
"openssl",
"pcntl",
"pcov",
"pdo_pgsql",
"pdo_sqlite",
"pdo",
"soap",
"tokenizer",
"xml",
"zip",
],
'include_composer_extensions' => true,
],
// RedisCanBeAccessed::class => [
// 'default_connection' => true,
// 'connections' => ["default"],
// ],
StorageDirectoryIsLinked::class,
],
/*
* Environment specific checks that will only be performed for the corresponding environment.
*/
'environment_checks' => [
'development' => [
ComposerWithDevDependenciesIsUpToDate::class,
ConfigurationIsNotCached::class,
RoutesAreNotCached::class,
ExampleEnvironmentVariablesAreUpToDate::class,
],
'production' => [
ComposerWithoutDevDependenciesIsUpToDate::class,
ConfigurationIsCached::class,
DebugModeIsNotEnabled::class,
PhpExtensionsAreDisabled::class => [
'extensions' => [
'xdebug',
],
],
RoutesAreCached::class,
// ServersArePingable::class => [
// 'servers' => [
// 'www.google.com',
// ['host' => 'www.google.com', 'port' => 8080],
// '8.8.8.8',
// ['host' => '8.8.8.8', 'port' => 8080, 'timeout' => 5],
// ],
//],
SupervisorProgramsAreRunning::class => [
'programs' => [
'horizon',
],
'restarted_within' => 300,
],
HorizonIsRunning::class,
],
],
];
```
Contributor guide
Research direction
Start with self-diagnosis.php and the PhpExtensionsAreInstalled check, reproducing the check inside Laravel Sail with the listed imagick configuration and the sail php -m output. Done means the check recognizes imagick as installed and no longer reports it missing, with regression coverage if the repository's existing tests cover this check.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- laravel, php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100