{"record":{"id":"974bb72cd69dcab5","repo":"ellite/Wallos","slug":"this-lang-extension-missing-openssl","errorCode":null,"errorMessage":"$this->lang('extension_missing') . 'openssl'","messagePattern":"\\$this->lang\\('extension_missing'\\) \\. 'openssl'","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"critical","filePath":"libs/PHPMailer/PHPMailer.php","lineNumber":2171,"sourceCode":"            }\n            $prefix = '';\n            $secure = $this->SMTPSecure;\n            $tls = (static::ENCRYPTION_STARTTLS === $this->SMTPSecure);\n            if ('ssl' === $hostinfo[1] || ('' === $hostinfo[1] && static::ENCRYPTION_SMTPS === $this->SMTPSecure)) {\n                $prefix = 'ssl://';\n                $tls = false; //Can't have SSL and TLS at the same time\n                $secure = static::ENCRYPTION_SMTPS;\n            } elseif ('tls' === $hostinfo[1]) {\n                $tls = true;\n                //TLS doesn't use a prefix\n                $secure = static::ENCRYPTION_STARTTLS;\n            }\n            //Do we need the OpenSSL extension?\n            $sslext = defined('OPENSSL_ALGO_SHA256');\n            if (static::ENCRYPTION_STARTTLS === $secure || static::ENCRYPTION_SMTPS === $secure) {\n                //Check for an OpenSSL constant rather than using extension_loaded, which is sometimes disabled\n                if (!$sslext) {\n                    throw new Exception($this->lang('extension_missing') . 'openssl', self::STOP_CRITICAL);\n                }\n            }\n            $host = $hostinfo[2];\n            $port = $this->Port;\n            if (\n                array_key_exists(3, $hostinfo) &&\n                is_numeric($hostinfo[3]) &&\n                $hostinfo[3] > 0 &&\n                $hostinfo[3] < 65536\n            ) {\n                $port = (int) $hostinfo[3];\n            }\n            if ($this->smtp->connect($prefix . $host, $port, $this->Timeout, $options)) {\n                try {\n                    if ($this->Helo) {\n                        $hello = $this->Helo;\n                    } else {\n                        $hello = $this->serverHostname();","sourceCodeStart":2153,"sourceCodeEnd":2189,"githubUrl":"https://github.com/ellite/Wallos/blob/52820e87ca5a6e105fdbb7f1c0c681bc0cfee2fd/libs/PHPMailer/PHPMailer.php#L2153-L2189","documentation":"smtpConnect() throws this critical error when the connection requires encryption (SMTPSecure is STARTTLS or SMTPS, or the Host list implies tls/ssl) but the PHP OpenSSL extension is unavailable, detected by checking the OPENSSL_ALGO_SHA256 constant rather than extension_loaded(). The message is the localized 'extension missing' string plus 'openssl'. Without OpenSSL, encrypted SMTP cannot proceed at all.","triggerScenarios":"Calling send() with isSMTP() and $mailer->SMTPSecure = 'tls' or 'ssl' (or port implying it) while the PHP runtime lacks the openssl extension, e.g. a minimal PHP build without ext-openssl.","commonSituations":"Custom-compiled PHP without --with-openssl, stripped Alpine/Docker images, some shared hosting setups with openssl disabled, or PHP CLI vs web SAPI differences where only one has the extension.","solutions":["Install/enable the OpenSSL extension: apt-get install php-openssl (usually bundled) or recompile PHP with --with-openssl.","In Docker images, install e.g. apk add --no-cache libssl / use an image with openssl built in.","Verify with php -m | grep openssl (and for the SAPI actually sending mail, check phpinfo()).","If encryption genuinely can't be enabled, downgrade to an unencrypted local relay (SMTPSecure = '', port 25) only on trusted networks.","Pin PHPMailer's requirement: add ext-openssl to composer.json so deployment fails fast on missing extension."],"exampleFix":"// before (php.ini)\n;extension=openssl\n// after (php.ini)\nextension=openssl\n// then verify: php -m | grep openssl","handlingStrategy":"validation","validationCode":"if ($mailer->SMTPSecure === PHPMailer::ENCRYPTION_STARTTLS || $mailer->SMTPSecure === PHPMailer::ENCRYPTION_SMTPS) {\n    if (!defined('OPENSSL_ALGO_SHA256')) {\n        throw new RuntimeException('ext-openssl required for encrypted SMTP');\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    $mailer->send();\n} catch (PHPMailer\\PHPMailer\\Exception $e) {\n    if (str_contains($e->getMessage(), 'openssl')) {\n        error_log('OpenSSL extension missing: enable ext-openssl in php.ini');\n    }\n}","preventionTips":["Require ext-openssl in composer.json so deploys fail early.","php -m | grep openssl in CI for the SAPI that sends mail (CLI vs FPM differ).","Use PHP base images with openssl compiled in.","Document the extension requirement for encrypted SMTP in onboarding docs."],"tags":["php","phpmailer","openssl","missing-extension","tls"],"backgroundTag":"missing-dependency","analyzedSha":"52820e87ca5a6e105fdbb7f1c0c681bc0cfee2fd","analyzedAt":"2026-09-13T14:09:30.873Z","contentChangedAt":"2026-09-13T14:09:30.873Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}