Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:66602 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 10084 invoked from network); 13 Mar 2013 20:37:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Mar 2013 20:37:51 -0000 Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lerdorf.com from 209.85.220.181 cause and error) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 209.85.220.181 mail-vc0-f181.google.com Received: from [209.85.220.181] ([209.85.220.181:37811] helo=mail-vc0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 15/37-05197-E93E0415 for ; Wed, 13 Mar 2013 15:37:51 -0500 Received: by mail-vc0-f181.google.com with SMTP id fw7so777425vcb.26 for ; Wed, 13 Mar 2013 13:37:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:cc :subject:references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding:x-gm-message-state; bh=HnKuX22DW4omztazhyfLt+XVfNWxeU5OEWeOhhZ5mA0=; b=MPEn+HonDWPrJCMICz2BGj58RXoU4qJFV1eopQn8OANyv9Nfz1BXEsT5CmLQeA/Dz1 U+SPSGvmIv9QKyzIZcaWBZh5GxrZOohHYLAbstcKwvmRt9mOmmbw4omPy5VZGWoflnKf OyuDyaHSufpiz5OdW9aLS7GWOUlUlyAajmy2ENsTZMz3+IBc2oWo1IQk+W4DMwIz8bzQ db7UUq4t7y/hgWu5kCzLiI8Sq4s/XuSkHM0Hevi/tHfduGiDMKC5k1IMwPWr/ElAfTv/ CUNRUw/WzHYZ39KtLxO4oEZhB9ICUgSjW0FGK0HX5a6887a9DrrGFU6X5Cd7cd9RY4fu 0o7Q== X-Received: by 10.58.232.98 with SMTP id tn2mr1240420vec.57.1363207067911; Wed, 13 Mar 2013 13:37:47 -0700 (PDT) Received: from [192.168.200.148] (c-50-131-44-225.hsd1.ca.comcast.net. [50.131.44.225]) by mx.google.com with ESMTPS id l5sm5911691vdi.4.2013.03.13.13.37.46 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 13 Mar 2013 13:37:47 -0700 (PDT) Message-ID: <5140E399.905@lerdorf.com> Date: Wed, 13 Mar 2013 13:37:45 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130221 Thunderbird/17.0.3 MIME-Version: 1.0 To: Thomas Anderson CC: internals@lists.php.net References: In-Reply-To: X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQmrdKbS96I3uje9IJmYT77TQJPTN96dKnc87TwZCfUFjmay4B4a647z0nEDJsCeZ6ljE8al Subject: Re: [PHP-DEV] idea: add wrapper support to mysqli_connect From: rasmus@lerdorf.com (Rasmus Lerdorf) On 03/13/2013 12:08 PM, Thomas Anderson wrote: > Instead of passing localhost to mysqli_connect as the $host parameter > I think it'd be useful if you could pass something like > ssh2.tunnel://user:pass@example.com:22/192.168.0.1:14 to it as well. > > The main advantage I see of doing that is that you could tunnel > through SSH2, through SOCKS, through HTTP CONNECT, etc, a lot more > easily than you currently can. Like you could have an SSH connection > re-created every time a PHP script is called and a tunnel dynamically > made instead of having a persistent tunnel created with autossh or > whatever. > > And even if SSH2 / SOCKS / CONNECT don't exist as built-in wrappers > custom stream wrappers could be made. This would additionally make it > easy for people to examine the underpinnings of MySQL. Instead of > intercepting the packets the MySQL client sends out and placing them > into an SSH tunnel or whatever one could just dump them to a log file > to better understand how MySQL clients work internally. Instead of adding all that gear to PHP itself, wouldn't it make more sense to just use something like autossh to maintain your ssh tunnel and have PHP connect to your tunnel endpoint? mysqli_connect() in PHP is just a thin wrapper on top of the underlying library. And your debugging use-case is also handled nicely by external tools that listen on a unix-domain socket, for example. -Rasmus