From owner-freebsd-questions@freebsd.org Tue Jan 17 16:36:41 2017 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 61B3ECB4572 for ; Tue, 17 Jan 2017 16:36:41 +0000 (UTC) (envelope-from markmoellering@psyberation.com) Received: from mail-yw0-x233.google.com (mail-yw0-x233.google.com [IPv6:2607:f8b0:4002:c05::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2A40618EA for ; Tue, 17 Jan 2017 16:36:40 +0000 (UTC) (envelope-from markmoellering@psyberation.com) Received: by mail-yw0-x233.google.com with SMTP id w75so92483309ywg.1 for ; Tue, 17 Jan 2017 08:36:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=psyberation-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=8Qax2A9xkIt9qQxMW8vUtClZzYQ0zBbXbf6jTIHRDw4=; b=TJFGSFKRtg3iXHKj0ZS5pkNCczBtiT3DWWwvQFr+twaX5LejcbgchEXM1vfWbGVUtA VPnuFdq7zyB10bciagyasbgropg8R+smWsljmMG08ApTMvBakqARWxBUZU/zhUmiQ9nE Kw3diBrsEHIIAC4DO8kVjE9LYlplsRIJXg6a5y/2/vL23H4AnBmae3fkc2oEvMHlenfc W9NsLdUs69g5JamDPPJcY5HWg0MnZITyMWlqsOhELwsRH2opJ2QtwEkQZkyOYy8bJc9C Dwk0fX0mtr/0ZL/JD2VqFwPE6w59c0TKV1RR5ymB4IWoHFj4WY4gdtzGsFMhBmETHp4H oPSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=8Qax2A9xkIt9qQxMW8vUtClZzYQ0zBbXbf6jTIHRDw4=; b=KrmkD9fRB7qRONp3ZzUkrBkwUfGu/EuHoshr/DTsx7qj1f2grO2pFJi57J4zt+aNOp bycx+gNO4QUa/QPz297kthFfS4yFtcYa/jL+NynFdOTluopHf0EdMYK2D4hslQ7U1Fis sH0+T/1up/KrURq4Nw+shoYp0Zepx+l43bBd1vPWwkdIjHvBzzaS/kGNy9IE5tUa7jF8 8IQ8vDysTymEiZVEo6Wp31PDXz1OFmKx8OUhqhDEVFx7tCPhqwqj8oTnTQh1DrhfaTBN IjQ4JG1ZywXNEIprsTDSphd5iR+XzkuprBaLjDxpHc0IPfmbnydwiYcJfR4Q/cdBKfEE zq5g== X-Gm-Message-State: AIkVDXIF7rt5Bdy/NwX02D5b8gGT6nYn2bf+PCTX84nf9bo+mDj+HV4JVIRDFteRadrGBIBIwTLt94rY4D3ZBA== X-Received: by 10.55.214.152 with SMTP id p24mr35303522qkl.223.1484671000032; Tue, 17 Jan 2017 08:36:40 -0800 (PST) MIME-Version: 1.0 Received: by 10.237.37.249 with HTTP; Tue, 17 Jan 2017 08:36:39 -0800 (PST) In-Reply-To: References: <9759d7e21a401b7f89f9318c1656867e.squirrel@webmail.harte-lyne.ca> <587DAD16.1040407@gmail.com> From: Mark Moellering Date: Tue, 17 Jan 2017 11:36:39 -0500 Message-ID: Subject: Re: A question about php in a jail To: byrnejb@harte-lyne.ca Cc: freebsd-questions@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jan 2017 16:36:41 -0000 On Tue, Jan 17, 2017 at 9:35 AM, James B. Byrne via freebsd-questions wrote: > > On Tue, January 17, 2017 00:35, Ernie Luzar wrote: >> James B. Byrne via freebsd-questions wrote: >>> This past week I have been setting up a jail for a drupal7 >>> website. I am now at the point where I need to update the >>> modules and I would like to employ the drush cli utility. >>> To install this on a Drupal7 website it is suggested to run >>> this command in the Drupal document root: >>> >>> >>> php -r >>> "readfile('https://s3.amazonaws.com/files.drush.org/drush.phar');" > >>> drush >>> >>> However, when I run this inside the jail then I see this error, >>> >>> PHP Warning: readfile(): Unable to find the wrapper "https" - did >>> you forget to enable it when you configured PHP? in Command line >>> code on line 1 >>> PHP Warning: >>> readfile(https://s3.amazonaws.com/files.drush.org/drush.phar): >>> failed to open stream: No such file or directory in Command >>> line code on line 1. >>> >>> If I run the same command on the host system of the jail then I >>> do not get this error. What am I missing with respect to the >>> jailed setup? >>> >> >> I have no idea what Drupal is and you provided no details about how >> you populated the jail with it. So just a shot in the dark. > > Thanks you for your reply. Drupal is a Web Content Management System. > Drush is an ancillary project that automates numerous common > maintenance tasks involving a Drupal installation. Both Drupal and > Drush are written in PHP. Drupal was installed using 'pkg install > drupal7' > >> >> Sounds like your jail does not have public internet access. Is the >> jails IP address being NATed by your hosts firewall? > > The jail does have internet access via NAT configured on our gateway > router. Installing and updating packages from within the jail work > fine. I can ssh in and out. I can ping the jail. I cannot ping out, > but that is expected behaviour for a jail. > >> >> Issuing "whois 9.9.9.9" from with in your running jail should return >> results if the jail/host firewall is configured correctly. >> >> You really need to post details about what steps you did before more >> people can help you. > > I regret is my original question was perfunctory. The issue seems to > me to be one of a missing component or php module rather than anything > to do with network connectivity. > > I initially took a too literal approach to installing Drush as there > exists a package for it. I installed Drush within the jail via pkg > install and things work fine. > > I am not sure what the issue is with php because I can wget the file > from inside the jail, I just cannot get the recommended php command to > work. > > # wget https://s3.amazonaws.com/files.drush.org/drush.phar > --2017-01-17 09:18:43-- > https://s3.amazonaws.com/files.drush.org/drush.phar > Resolving s3.amazonaws.com (s3.amazonaws.com)... 54.231.80.243 > Connecting to s3.amazonaws.com > (s3.amazonaws.com)|54.231.80.243|:443... connected. > HTTP request sent, awaiting response... 200 OK > Length: 6135132 (5.9M) [application/octet-stream] > Saving to: 'drush.phar' > > drush.phar 100%[=======================>] 5.85M 1.20MB/s > in 5.0s > > 2017-01-17 09:18:58 (1.17 MB/s) - 'drush.phar' saved [6135132/6135132] > > > # php -r > "readfile('https://s3.amazonaws.com/files.drush.org/drush.phar');" > > drush > PHP Warning: readfile(): Unable to find the wrapper "https" - did you > forget to enable it when you configured PHP? in Command line code on > line 1 > PHP Warning: > readfile(https://s3.amazonaws.com/files.drush.org/drush.phar): failed > to open stream: No such file or directory in Command line code on line > 1 > > > I ran across references to 'extension=php_openssl.dll' in php.ini > having some bearing on this elsewhere > (https://stackoverflow.com/questions/5444249/unable-to-find-the-wrapper-https-did-you-forget-to-enable-it-when-you-config) > but I cannot see that a .dll and FreeBSD have much in common. > None-the-less I checked this and found these references: > > # grep php_openssl /usr/local/etc/* > /usr/local/etc/php.ini:;extension=php_openssl.dll > /usr/local/etc/php.ini-development:;extension=php_openssl.dll > /usr/local/etc/php.ini-production:;extension=php_openssl.dll > > Changing the commented reference in /usr/local/etc/php.ini gives the > dismal results I anticipated: > > # php -r > "readfile('https://s3.amazonaws.com/files.drush.org/drush.phar');" > > drush > PHP Warning: PHP Startup: Unable to load dynamic library > '/usr/local/lib/php/20131226/php_openssl.dll' - Cannot open > "/usr/local/lib/php/20131226/php_openssl.dll" in Unknown on line 0 > PHP Warning: readfile(): Unable to find the wrapper "https" - did you > forget to enable it when you configured PHP? in Command line code on > line 1 > PHP Warning: > readfile(https://s3.amazonaws.com/files.drush.org/drush.phar): failed > to open stream: No such file or directory in Command line code on line > 1 > > > Fortunately, the packaged version of Drush installed cleanly and works > fine. The only mystery I have is why the errors only occur in the > jail. > > I think this may be more of a php issue. I haven't set up Drupal in a jail but I know php and I know jails. Here are my thoughts. php can have multiple .ini files, one file for the webserver, (Apache, Nginx, etc.) and another one for running from the command line. If you search for php.ini on your system and find two (or more) , that could be the issue, you could have different settings in the two .php files. There are a couple of gotchas about jails. You don't have access to devices or other items that some programs require, unless you set them up. Some programs or specific commands may need access to specific parts of the kernel. Postgresql (for example) requires access to System V flags, which operate at the kernel level and require some extra set up steps to get working in a jail. If you are having problems, try and figure out what parts of the system a program needs access to and then try and figure out if the jail has that access, or if you need to simulate it, etc. Good Luck Mark Moellering