Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect php extension parsing in Laravel Sail #110

Open
mikebronner opened this issue Feb 15, 2022 · 0 comments
Open

Incorrect php extension parsing in Laravel Sail #110

mikebronner opened this issue Feb 15, 2022 · 0 comments

Comments

@mikebronner
Copy link
Contributor

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:

sail php -r 'echo "imagick is ".(extension_loaded("imagick")?"":"not ")."installed\n";'

Also, sail php -m has the following output, which includes imagick:

[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

declare(strict_types=1);

use BeyondCode\SelfDiagnosis\Checks\AppKeyIsSet;
use BeyondCode\SelfDiagnosis\Checks\ComposerWithDevDependenciesIsUpToDate;
use BeyondCode\SelfDiagnosis\Checks\ComposerWithoutDevDependenciesIsUpToDate;
use BeyondCode\SelfDiagnosis\Checks\ConfigurationIsCached;
use BeyondCode\SelfDiagnosis\Checks\ConfigurationIsNotCached;
use BeyondCode\SelfDiagnosis\Checks\CorrectPhpVersionIsInstalled;
use BeyondCode\SelfDiagnosis\Checks\DatabaseCanBeAccessed;
use BeyondCode\SelfDiagnosis\Checks\DebugModeIsNotEnabled;
use BeyondCode\SelfDiagnosis\Checks\DirectoriesHaveCorrectPermissions;
use BeyondCode\SelfDiagnosis\Checks\EnvFileExists;
use BeyondCode\SelfDiagnosis\Checks\ExampleEnvironmentVariablesAreSet;
use BeyondCode\SelfDiagnosis\Checks\ExampleEnvironmentVariablesAreUpToDate;
use BeyondCode\SelfDiagnosis\Checks\HorizonIsRunning;
use BeyondCode\SelfDiagnosis\Checks\LocalesAreInstalled;
use BeyondCode\SelfDiagnosis\Checks\MaintenanceModeNotEnabled;
use BeyondCode\SelfDiagnosis\Checks\MigrationsAreUpToDate;
use BeyondCode\SelfDiagnosis\Checks\PhpExtensionsAreDisabled;
use BeyondCode\SelfDiagnosis\Checks\PhpExtensionsAreInstalled;
use BeyondCode\SelfDiagnosis\Checks\RedisCanBeAccessed;
use BeyondCode\SelfDiagnosis\Checks\RoutesAreCached;
use BeyondCode\SelfDiagnosis\Checks\RoutesAreNotCached;
use BeyondCode\SelfDiagnosis\Checks\ServersArePingable;
use BeyondCode\SelfDiagnosis\Checks\StorageDirectoryIsLinked;
use BeyondCode\SelfDiagnosis\Checks\SupervisorProgramsAreRunning;

return [

    /*
     * A list of environment aliases mapped to the actual environment configuration.
     */
    'environment_aliases' => [
        '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,
        ],
    ],

];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant