{"id":5328,"date":"2020-01-09T13:01:39","date_gmt":"2020-01-09T07:31:39","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=5328"},"modified":"2026-11-07T13:35:26","modified_gmt":"2026-11-07T08:05:26","slug":"php-warning-module-ssh2-already-loaded-in-unknown-on-line-0","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/php-warning-module-ssh2-already-loaded-in-unknown-on-line-0\/","title":{"rendered":"PHP SSH2 Module Already Loaded: How to Fix the Warning"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>Post Date:<\/strong> January 9, 2020 <br><strong>Last Updated:<\/strong> November 07, 2026<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This guide explains how to fix the ssh2 already loaded warning in PHP. It appears whenever you run PHP, in the terminal, in cron output, or in your logs:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">PHP Warning:  Module 'ssh2' already loaded in Unknown on line 0\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">When PHP prints ssh2 already loaded, it means the <code>ssh2<\/code> extension is being loaded more than once. PHP only loads each extension a single time, so the second attempt produces the warning. The extension itself still works. The message is a sign that your PHP configuration has a duplicate entry.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The original guide suggested commenting out a line or removing a file. That works, but only if you disable the right one. If you comment out the only line that loads <code>ssh2<\/code>, the extension stops working altogether. This version shows how to find every place it&#8217;s loaded first.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before you fix the ssh2 already loaded warning, make sure you have:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Root or sudo access to the server<\/li>\n\n\n\n<li>Access to the command line, so you can run <code>php<\/code> directly<\/li>\n\n\n\n<li>A backup of any configuration file you&#8217;re about to change<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Architecture<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>When PHP starts, it reads the main <code>php.ini<\/code> file<\/li>\n\n\n\n<li>It then scans an extra configuration folder (usually <code>php.d<\/code> or <code>conf.d<\/code>) and reads every <code>.ini<\/code> file in it, in alphabetical order<\/li>\n\n\n\n<li>Each <code>extension=<\/code> line in those files loads a module. If two lines load the same module, PHP warns that it&#8217;s already loaded<\/li>\n\n\n\n<li>The warning is printed during startup, before any script has been opened, which is why PHP can only say &#8220;Unknown on line 0&#8221;<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The image below shows how the ssh2 already loaded warning is triggered. For how PHP finds its configuration files, see the PHP manual&#8217;s page on the <a href=\"https:\/\/www.php.net\/manual\/en\/configuration.file.php\" target=\"_blank\" rel=\"noopener\">configuration file<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2020\/01\/Fixing-the-PHP-SSH2-Warning.png\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"683\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2020\/01\/Fixing-the-PHP-SSH2-Warning-1024x683.png\" alt=\"\" class=\"wp-image-13000\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2020\/01\/Fixing-the-PHP-SSH2-Warning-1024x683.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2020\/01\/Fixing-the-PHP-SSH2-Warning-300x200.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2020\/01\/Fixing-the-PHP-SSH2-Warning-768x512.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2020\/01\/Fixing-the-PHP-SSH2-Warning-272x182.png 272w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2020\/01\/Fixing-the-PHP-SSH2-Warning.png 1536w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Steps to Fix the ssh2 Already Loaded Warning<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. See the Warning and Find Your Config Files<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Run PHP from the command line to see the ssh2 already loaded warning for yourself:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php -v\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The warning appears at the top, above the version information. Then list the configuration files PHP is reading:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php --ini\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Note the &#8220;Loaded Configuration File&#8221; and the &#8220;Scan for additional .ini files in&#8221; folder.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> If your server runs several PHP versions, such as cPanel or Plesk multi-PHP, run these commands with the specific PHP binary you&#8217;re troubleshooting, because each version has its own <code>php.d<\/code> folder.<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">2. Find Every Place That Loads ssh2<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Search the main file and the extra folder shown by <code>php --ini<\/code>. For example:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">grep -rn \"ssh2\" \/etc\/php.ini \/etc\/php.d\/ 2>\/dev\/null\ngrep -rn \"ssh2\" \/etc\/php\/ 2>\/dev\/null\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Look for lines such as:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">extension=ssh2.so\nextension=ssh2\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Both forms load the module, so check for both. If you find two or more, you&#8217;ve found the duplicate PHP extension entry that causes the warning.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> On Debian and Ubuntu, the <code>cli<\/code>, <code>fpm<\/code>, and <code>apache2<\/code> folders each hold a link to the same <code>ssh2.ini<\/code> file. That&#8217;s normal, and each one is loaded only once by its own PHP type. The problem is a second, separate line in <code>php.ini<\/code> or in another <code>.ini<\/code> file.<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">A common cause is installing the extension twice: once from your distribution&#8217;s package and once with <code>pecl install ssh2<\/code>. PECL often adds its own <code>extension<\/code> line to <code>php.ini<\/code>, on top of the package&#8217;s own <code>.ini<\/code> file.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. Keep One and Disable the Others<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Back up the file first, then disable all but one:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Duplicate line:<\/strong> edit the file and put a semicolon at the start of the extra line, so it reads <code>;extension=ssh2.so<\/code><\/li>\n\n\n\n<li><strong>Duplicate file:<\/strong> if two separate <code>.ini<\/code> files both load <code>ssh2<\/code>, move one out of the folder, for example <code>sudo mv \/etc\/php.d\/duplicate-ssh2.ini \/root\/duplicate-ssh2.ini.bak<\/code><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">This clears the ssh2 already loaded warning, as long as exactly one entry remains. Don&#8217;t disable every entry.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4. Reload PHP<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The command line picks up the change immediately. For websites, restart the service your site uses. For PHP-FPM:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo systemctl restart php-fpm\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">On Debian and Ubuntu, the service name includes the version, for example <code>php8.2-fpm<\/code>. If you use PHP through Apache, restart Apache instead (<code>apache2<\/code> or <code>httpd<\/code>).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">5. Verify<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php -v\nphp -m | grep -i ssh2\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The warning should be gone, and <code>ssh2<\/code> should still appear in the module list. If it&#8217;s missing from the list, you disabled the only entry, so restore one line.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Troubleshooting<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If the ssh2 already loaded warning is still there, check these:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>It&#8217;s gone in the terminal but still in website logs:<\/strong> the web server&#8217;s PHP uses a different set of config files, such as the <code>fpm<\/code> folder on Debian and Ubuntu. Check the files for that PHP type<\/li>\n\n\n\n<li><strong><code>Call to undefined function ssh2_connect()<\/code> after the change:<\/strong> you disabled every entry. Re-enable one<\/li>\n\n\n\n<li><strong>You installed the extension two ways:<\/strong> remove one of them, for example with <code>pecl uninstall ssh2<\/code> or by removing the distribution package, and keep a single source<\/li>\n\n\n\n<li><strong>A different module is reported:<\/strong> the same warning appears for any extension loaded twice, and the same steps apply<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To fix the ssh2 already loaded warning in PHP, find every <code>extension<\/code> line that loads <code>ssh2<\/code> with <code>php --ini<\/code> and <code>grep<\/code>, keep exactly one, disable the others, reload PHP, and confirm with <code>php -v<\/code> and <code>php -m<\/code>. The key detail is checking before you disable anything, so you don&#8217;t remove the only entry.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently Asked Questions<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Why does the ssh2 already loaded warning show Unknown on line 0?<\/strong> The warning is raised while PHP is starting up, before it opens any script. There&#8217;s no file or line to report yet, so PHP prints &#8220;Unknown on line 0&#8221;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Can the ssh2 already loaded warning break my site?<\/strong> The extension keeps working, but the warning can be printed into your page output or cron mail. On a website, that can cause problems such as &#8220;headers already sent&#8221; errors, so it&#8217;s worth fixing.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Does this apply to other extensions?<\/strong> Yes. The same &#8220;already loaded&#8221; warning appears for any module listed twice, and the same fix works.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Should I use a distribution package or PECL for ssh2?<\/strong> Either works, but use only one. The distribution package is easier to keep updated with the system, while PECL gives you more control over the version.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Related Articles<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/phpmyadmin-configuration-storage-not-completely-configured-extended-features-deactivated\/\" target=\"_blank\" rel=\"noreferrer noopener\">Resolve phpMyAdmin Configuration Storage Warning and Enable Extended Features<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/php2shell-vulnerability\/\" target=\"_blank\" rel=\"noreferrer noopener\">PHP2Shell Vulnerability: How to Protect Your PHP Server from CVE-2026-109618 and CVE-2026-109619<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Talk to Our Technology Experts<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Seeing PHP warnings or extension conflicts on your servers? Our team can help with PHP configuration, multi-version setups, and ongoing server support.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/contact\">Connect with our technology experts.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Post Date: January 9, 2020 Last Updated: November 07, 2026 Introduction This guide explains how to fix the ssh2 already [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":13001,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1022],"tags":[742],"class_list":["post-5328","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-web-architecture","tag-ssh2","psol-cat-web-architecture"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-1nW","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2020\/01\/PHP-SSH2-Warning-Quick-Fix.png","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/5328","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=5328"}],"version-history":[{"count":2,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/5328\/revisions"}],"predecessor-version":[{"id":13003,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/5328\/revisions\/13003"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media\/13001"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=5328"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=5328"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=5328"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}