I'd just add the following to your Dockerfile:
Thanks neubert
I did ( to a point ) get it working late last night, and I think I have recalled the steps correctly and listed below :
Code
Used Portainer in browser and went to the Container for nginx.
Used 'Console' to open a terminal windows ( I'm guessing this is unique to the Docker container ).
cd config
cd www
cd MYdata ( folder where my php scripts run )
mkdir composer
cd composer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'dac665fdc30fdd8ec78b38b9800061b4150413ff2e3b6f88543c636f7cd84f6db9189d43a81e5503cda447da73c7e5b6') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
^ creates composer.phar
php composer.phar install
^ this installs composer and creates composer.json, composer.lock and /vendor
composer.json contains :
{
"require": {
"phpseclib/phpseclib": "~3.0"
}
}
Display More
I now have, in my MYdata folder ( where all my php script files reside that I can run from my browser ), the following :
Code
/composer
/vendor
/phpseclib
/phpseclib
/phpseclib
/Common
/Crypt
/Exception
/File
/Math
/Net
/SFTP.php
/SSH2.php
/SFTP
/Stream.php
/System
Display More
now it breaks my test php script, which is to upload the file to the SFTP server ( all previously working with phpseclib v1 ) :
Code
$CodeRoot = dirname(__FILE__);
set_include_path(get_include_path() . PATH_SEPARATOR . $CodeRoot.'/composer/vendor/phpseclib/phpseclib/phpseclib');
use $CodeRoot.'/composer/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP';
^^ this completely breaks the script with the browser showing :
This page isn’t working
192.123.1.123 is currently unable to handle this request.
HTTP ERROR 500
if I change the code to :
$CodeRoot = dirname(__FILE__);
set_include_path(get_include_path() . PATH_SEPARATOR . $CodeRoot.'/composer/vendor/phpseclib/phpseclib/phpseclib');
include $CodeRoot.'/composer/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php';
when I later try to start a connection with :
$ftp_conn11 = new SFTP($ftpServer);
it breaks with :
Fatal error: Uncaught Error: Class 'phpseclib3\Net\SSH2' not found in /config/www/MYdata/composer/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php:44 Stack trace: #0 /config/www/MYdata/exdgoSFTPtest.php(14): include() #1 {main} thrown in /config/www/MYdata/composer/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php on line 44
Display More
It seems to be so close, but unless I can find more brain cells, it seems the solution is constantly just out of reach.