creating a path to wordpress in SSH Tunnel - ssh

I made a rookie mistake that I'm trying to correct.
I need to access a wordpress installation and edit the database, but the host doesn't provide a control panel or phpMyadmin so I set up an ssh tunnel. I installed wp cli and verified the installation. It all looks right
$ php wp-cli.phar --info
OS: Linux 4.15.0-147-generic #151-Ubuntu SMP Fri Jun 18 19:21:19
UTC 2021 x86_64
Shell: /bin/bash
PHP binary: /RunCloud/Packages/php74rc/bin/php
PHP version: 7.4.21
php.ini used: /etc/php74rc/php.ini
MySQL binary: /usr/bin/mysql
MySQL version: mysql Ver 15.1 Distrib 10.2.40-MariaDB, for debian-
linux-gnu (x86_64) using readline 5.2
SQL modes:
WP-CLI root dir: phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir: phar://wp-cli.phar/vendor
WP_CLI phar path: /home/wordpress_installation (assumed)
WP-CLI packages dir:
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.5.0`
But when I used a wp command, I got an error this doesn't appear to be a wordpress installation I was pretty sure I had the right path, and the error said to download wordpress. So I did that. But now it's asking for me to make a config file
'wp-config.php' not found. Either create one manually or use `wp config create`
I don't want to do that. I must have the wrong path and will need to get that information from the host. But in the meantime, How can undo the wordpress installation.
Or get back to
WP-CLI root dir: phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir: phar://wp-cli.phar/vendor
WP_CLI phar path: /home/wordpress_installation (assumed)

I got bold/reckless and tried a few things. I was able to find find the directories and get the correct one. So now I have a WordPress download on the server but I'm not tied to it. I could probably just go onto the FTP and delete the files. But I'm chicken.

Related

How to install Apache on OmniOS

I am attempting to install Apache on OmniOS. I followed the instructions here: option 2 https://wiki.openindiana.org/oi/3.+Installing+software+and+package+management
Ran the command:
echo $PATH results in /opt/local/sbin:/opt/local/bin:/usr/gnu/bin:/usr/sbin:/sbin
curl https://pkgsrc.joyent.com/packages/SmartOS/bootstrap/bootstrap-2016Q4-x86_64.tar.gz | gtar -zxpf - -C /
pkgin -y update
pkgin -y install apache-2.4.6 resulted in the messages Calculating dependencies...done and then nothing to do
I can not find the apache service or configuration directory as they are described here: https://docs.joyent.com/public-cloud/instances/infrastructure/images/smartos/apache
/opt/local/etc/httpd The configuration directory for Apache
svcs pkgsrc/apache Checking service for Apache
Server Info:
uname -v results in omnios-r151026-d9b45886bd
Running x86
Also running SunONE webserver
Though incomplete, my commands did make a change. My Perl scripts can no longer find DBI.
Why does the Apache install say there is nothing to do? What am I missing?
UPDATE
Ran which apache2 resulted in no apache2
Ran pkgin list to list all installed packages. Only apache
reference is apache-maven-3.5.4
Ran find . -name '*apache*' in the following directories:
\etc nothing
\opt found:
vim, el, and elc files in SUNWspro
org-apache-tools-ant-module files and folder in netbeans/3.5V11/modules/patches
apache folder in SUNWwbsvr/plugins/java/samples/webapps/jstl/src/org which contains java files
vim, tag, el and elc files in sfw --- also an apache folder in sfw which contains readme/bash type files for apache/php and one so file
apache-maven-3.5.4 files/folders in local
org-apache-xml-resolver* files in sunstudio12.1
'\usr' found:
2 vims in share/vim/vim80/syntax
apache-fcgi.conf in lib/python2.7/vendor-packages/cherrypy/scaffold
'\var' nothing
As far as I can tell, the binaries have not been installed
I tried running pkgin -y install apache-2 and it worked. It installed apache-2.4.3. Perhaps apache-2.4.6 does not exist in the repository.
This mean apache is already installed on the Linux system. To run below command which will tell the location of the system binary.
which apache2
for the configuration folder look for below directory:
/etc/apache2

Using "Remote SSH" in VSCode on a target machine that only allows inbound SSH connections

Is there a way to use the VSCode Remote SSH extension to interact with a remote host that does not allow outbound internet connections?
Is it possible to download the vscode-server files from another system and copy to host?
I read this but I can't connect the server to internet.
When you connect to a host it executes a bash script that wgets or curls a tarball and extracts it in a directory in your home directory. Here's an offline workaround.
Attempt to connect, let it fail
On server, get the commit id
$ ls ~/.vscode-server/bin
553cfb2c2205db5f15f3ee8395bbd5cf066d357d
Download tarball replacing $COMMIT_ID with the the commit number from the previous step
For Stable Version
https://update.code.visualstudio.com/commit:$COMMIT_ID/server-linux-x64/stable
For Insider Version
https://update.code.visualstudio.com/commit:$COMMIT_ID/server-linux-x64/insider
Move tarball to ~/.vscode-server/bin/$COMMIT_ID/vscode-server-linux-x64.tar.gz
Extract tarball in this directory
$ cd ~/.vscode-server/bin/$COMMIT_ID
$ tar -xvzf vscode-server-linux-x64.tar.gz --strip-components 1
Connect again
You'll still need to install any extensions manually. There's a download button next to all the extensions in the marketplace. Once you have the .vsix file you can install them through the GUI with the Install from VSIX option in the extensions manager.
This is kind of a pain and hopefully they improve this process, but if you have a network-based home directory, you only have to do this once.
open vscode -> about
Version: 1.46.1
Commit: cd9ea6488829f560dc949a8b2fb789f3cdc05f5d
Date: 2020-06-17T21:17:14.222Z
Electron: 7.3.1
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Darwin x64 17.7.0
$COMMIT_ID = cd9ea6488829f560dc949a8b2fb789f3cdc05f5d
A new feature is being added to support offline install
However, you can now solve this issue by a new user setting in the Remote - SSH extension. If you enable the setting remote.SSH.allowLocalServerDownload, the extension will install the VS Code Server on the client first and then copy it over to the server via SCP.
Note: This is currently an experimental feature but will be turned on by default in the next release
https://code.visualstudio.com/blogs/2019/10/03/remote-ssh-tips-and-tricks
A a work around I have done the following:
Desktop ~/.ssh/config
...
Host *
RemoteForward 54321
...
Remote: ~/bin/wget in which ~/bin is added to PATH via .bashrc
#!/bin/bash
export LD_LIBRARY_PATH=$HOME/opt/lib/tsocks/
export TSOCKS_CONF_FILE=$HOME/opt/tsocks/tsocks.conf
$HOME/bin/tsocks /usr/bin/wget $#
Remote: ~/opt/tsocks/tsocks.conf
server = 127.0.0.1
server_port = 54321
server_type = 5
note tsocks binary has been scp-ed to ~/bin/tsocks and ~/opt/tsocks/ has been created with libtsocks.so which is normally stored in /usr/lib64/libtsocks.so
This is a work around that allows me to have wget functionality with out messing with anything outside my profile to get it to work (eg: no root required ... even though I have it).
Current Version of VS Code: 1.48.2
I just kill the wget process on the server end, and let the client download the archive and transfer it to the server end. That's quite easy as below.
make sure that you set in settings.json
"remote.SSH.allowLocalServerDownload": true,
execute the shell scrpits below.
# to find the <pid>
ps aux | grep wget | grep vscode-server
# kill the process
kill -9 <pid>
# then wait for the client downloading and transferring
# optional: If you want to know the progress, just
cd ~/.vscode-server/bin/<commit-id>/
watch -n 1 -d ls -rthl

Can ddev work with WSL (Windows Subsystem for Linux)?

As a person working on a Windows machine but enjoying Ubuntu as a working environment I'd like to use ddev in WSL. Is there a way to do that?
2021 Update: DDEV has WSL2 install instructions.
(2018-11-15: Updated for ddev v1.4.0)
It's pretty tweaky, but it can be done. Note that there are no tests or performance results on this, and it's not a supported technique.
Note that WSL actually behaves like linux and uses linux binaries, so you'll use the linux version of ddev.
The biggest problem is that the docker daemon is running under native Windows and WSL has a different filesystem layout, so you have to kind of trick everything on the WSL side to use paths that the Docker daemon will be able to find in native windows.
Start by setting up your WSL/Docker environment as described in this excellent article: https://nickjanetakis.com/blog/setting-up-docker-for-windows-and-wsl-to-work-flawlessly#ensure-volume-mounts-work - BUT use DOCKER_HOST=tcp://127.0.0.1:2375 instead of using "localhost" in there.
Install ddev using the Linux instructions.
Make sure all projects are already rm'd with ddev rm -a; projects already running or stopped in native Windows can't be accessed by ddev from WSL-land.
You're probably going to use the web browser on your windows side of the machine, so add the hostname of your project on the Windows side with ddev hostname <yourproject.ddev.local> 127.0.0.1
cd /c/Users//path/to/project (This is a path docker understands.)
ddev start
Visit the project with your browser.
Basically, with this technique you're using paths that the Docker daemon knows how to follow in native windows.
Anyway, it seems to work with a trivial example. Your comments are welcome and we may be able to improve support in the future if people like it.
I have it working (current 1.5.1) inside of WSL. I'm using Docker Toolbox so Docker4Windows may be different.
General setup inside of WSL (I'm using ubuntu)
install docker (apt-get install docker.io)
copy default docker machine certificates to WSL via
cp /mnt/c/Users/[YOUR WINDOWS USER]/.docker/machine/machines/default/*.pem ~/.docker
setup your environment variable inside of WSL (eg. in ~/.bashrc)
export DOCKER_HOST=tcp://192.168.99.100:2376
export DOCKER_TLS_VERIFY=1
export DOCKER_CERT_PATH=~/.docker
The actual values to use can be determined via docker-machine.exe env from the docker toolbox!
At this point you should get a complete output from docker version (don't forget to restart your shell to actually load the modified environment)
Client:
Version: 18.06.1-ce
API version: 1.38
Go version: go1.10.4
Git commit: e68fc7a
Built: Fri Oct 19 19:43:14 2018
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 18.06.1-ce
API version: 1.38 (minimum version 1.12)
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:28:38 2018
OS/Arch: linux/amd64
Experimental: false
Containers can't be started yet as the mount of file systems will fail!
With Docker Toolbox the docker server has the host file system available under /c/. But running from WSL the expected path is /mnt/c/
Generating a symlink is sufficient to make it available docker-machine.exe ssh default 'sudo ln -s /c /mnt/c'
This command has to be rerun after reboot or you have to make the changes permanent via the bootlocal.sh mechanism.
Test your mapping with docker run --rm -i -t -v ${PWD}:/mnt ubuntu bash from WSL.
Install docker-compose, depending on your distribution it is outdated and needs to be replaced with a current version.
Enjoy ddev

Upgrading openssl from 0.9.8 to 1.0.2 / Ubuntu 8.04 LTS

first of all, thanks for your time trying to help.
I have an old server, Ubuntu 8.04, not supported anymore.
Since June, a payment platform I'm working with has deactivated the TLSv1 and SSL.
My server is running under :
Apache 2.2.8 /
Openssl 0.9.8 /
PHP 5.2.17 /
Ubuntu 8.04
I have installed a new version of openssl (using wget) :
openssl version
OpenSSL 1.0.2o 27 Mar 2018
My version of apache is too old to support TLSv1.2, I need to upgrade it to apache 2.2.23 minimum version.
How to compile apache in order to take into account the new OpenSSL version?
PS: I just take a new server to migrate my website, but it takes time to adapt the code... Changing the server is not an option for now .. I need to make it work as fast as possible, and then I'll be able to focus on the error introduced by PHP 7...
Thanks in advance to help the newbie i am..
Since this old Ubuntu is no longer supported, you can most probably not use the repos to install Apache.
Compiling your own is doable following instructions here: http://httpd.apache.org/docs/2.2/install.html.
When you run ./configure you will have to use --enable-ssl and --with-ssl=DIR. The DIR is where OpenSSL resides (not the source code, but the installation directory). Check the ./configure output to identify any missing requisites.
Once you run make install, you will then have to compile PHP with that new OpenSSL, and link to the newly compiled Apache. http://ca3.php.net/manual/en/install.unix.apache2.php
This is how I compile my HTTP (notes taken a while back, some versions might differ). Adapt for your needs, and this is provided "as is", no warranty :-)
The prerequisites are based on RHEL 6 or 7, adapt as required.
Required software:
- apr-1.6.2
- apr-iconv-1.2.1
- apr-util-1.5.4
- httpd-2.4.26
(identical procedure used with previous versions of 2.4)
- openssl-1.0.2l
(identical prodecure used with older versions of 1.0)
- Unzip and untar these under /opt/app/SOURCES
System setup
Ask Unix to create:
- /opt/app/httpd, owner httpd, group httpd, permissions 775
- user httpd, group httpd
Create these directories
- /opt/app/apr
- /opt/app/apr-iconv
- /opt/app/apr-util
- /opt/app/httpd
- /opt/app/openssl
- all owned by httpd, group httpd, permissions 750
Procedure
Get Unix to install prerequisites
for F in libxml2.i686 libxml2.x86_64 libxml2-devel.i686 libxml2-devel.x86_64 apr-devel.i686 apr-devel.x86_64 apr-util.i686 apr-util.x86_64 pcre-devel.i686 pcre-devel.x86_64 autoconf libtool
do
yum install -y $F
done
Switch to the httpd user.
Install APR
cd /opt/app/SOURCES/apr-1.6.2
./buildconf
./configure --prefix=/opt/app/apr
make
make install
Keep the directory as is, APR Util and APR Iconv require the APR sources to refer to.
Install APR Util
cd /opt/app/SOURCES/apr-util-1.5.4
./buildconf --with-apr=/opt/app/SOURCES/apr-1.6.2
./configure --prefix=/opt/app/apr-util --with-apr=/opt/app/apr
make
make install
Install APR Iconv
cd /opt/app/SOURCES/apr-iconv-1.2.1
./configure --prefix=/opt/app/apr-iconv --with-apr=/opt/app/apr
make
make install
Install OpenSSL
cd /opt/app/SOURCES/openssl-1.0.2l
export CFLAGS=-fPIC
./config --prefix=/opt/app/openssl --openssldir=/opt/app/openssl shared
make clean
make
make test
make install
Install Apache
cd /opt/app/SOURCES/httpd-2.4.26
export LD_LIBRARY_PATH=/opt/app/openssl/lib
./configure --prefix=/opt/app/httpd --with-mpm=worker --enable-rewrite --enable-ssl --with-ssl=/opt/app/openssl --enable-proxy --enable-rewrite --enable-log-forensic --enable-log-debug --enable-expires --enable-headers --enable-unique-id --with-apr=/opt/app/apr --with-apr-util=/opt/app/apr-util
make
make install
vi /opt/app/httpd/bin/envvars
Add /opt/app/openssl/lib to the LD_LIBRARY_PATH
Note for the ./configure: this was done to build an Apache used as a proxy. change the --enable* options as required.
Configure HTTP
- The original configuration files after installation are saved in /opt/app/httpd/conf/original
- While it is impossible to cover all configuration options, at least these should be changed from the install configuration:
--- Listen 80: change as required.
--- User httpd
--- Group httpd
--- ServerAdmin EMAILADDRESS
--- ServerName <HOSTNAME>:80
--- Comment or uncomment the modules, as required
--- Uncomment slotmem_shm_module
--- Comment: CustomLog "logs/access_log" common
--- Uncomment: CustomLog "logs/access_log" combined
--- Comment the following sections (the entire section!):
----- <IfModule alias_module>
----- <IfModule cgid_module>
----- <Directory "/opt/app/httpd/cgi-bin">
--- Uncomment:
----- Include conf/extra/httpd-mpm.conf
----- Include conf/extra/httpd-default.conf
----- Edit conf/extra/httpd-mpm.conf
----- Change performance options as required. The defaults are ok until you have a large amount of traffic.
----- Edit conf/extra/httpd-default.conf
----- Comment AccessFileName .htaccess
----- ServerTokens Prod
--- Test the configuration: /opt/app/httpd/bin/apachectl -t
--- Start it and access it with a browser. It should return a simple "It works!" message (unless you have installed some HTML content).
And this is my procedure for PHP compilation, again no warranty, "as is". You can ignore the parts about DB2, Oracle and PostgreSQL if you do not connect to these DB.
Prerequisites
- A compiled version of Apache HTTP and it's requisites. See HTTP installation.
- It "could" work with RedHat's compiled Apache, but it is not recommended. If RH's Apache is used, might as well use RH's PHP build.
- PHP source code: download from http://php.net
- This procedure has been tested with success on versions: 5.3.13, 5.5.7, 5.6.3, 5.6.30. No modifications were required.
Install Red Hat pre-requisites:
- libxml, libxml-devel
- libpng, libpng-devel
- libjpg, libjpg-devel
If using DB2
- Install DB2 client under /opt/app
- PHP searches for the lib directory, so:
cd /opt/app/ibm/db2/V10.5
ln -s lib64 lib
If using Oracle
- Install the Oracle Instant Client in /opt/app/oracle
Overview
PHP must be compiled and "linked" to Apache. Apache must therefore be compiled before PHP.
Depending on which database PHP will connect to, the configure options must be changed.
http://php.net has more documentation and details for the build process, this is just what was used.
Build
Pre-compile configure
The configure command will detect what other software is installed on the system and link libraries.
Note for the database clients: they can all be linked at the same time, but it is recommended to link only the ones required.
The command is:
./configure --with-apxs2=/opt/app/httpd/bin/apxs \
--prefix=/opt/app/php \
--with-config-file-path=/opt/app/php \
--enable-zip \
--with-zlib \
--enable-mbstring \
--with-gd \
--with-pear \
--with-pdo-odbc=ibm-db2,/opt/app/ibm/db2/V10.5 \ # if using DB2 only!
--with-oci8=instantclient,/opt/app/oracle/instantclient_11_2 # if using Oracle only!
--with-pgsql \ # if using PostgreSQL only!
--with-pdo-pgsql # if using PostgreSQL with PDO only!
Compile
make clean
make
make test
make install
$(make test) will report errors for the Oracle driver. MANY errors! The driver will still work (it was used for the nettracker replacement scripts to load Pharmaclik IBM HTTP Server logs into Oracle). But it will be impossible to use bind variables on Integers. That explains why that script does not use oci_bind* functions.
Post-compile configure
libtool --finish /opt/app/php/lib
cp php.ini-development /opt/app/php/php.ini
OR
cp php.ini-production /opt/app/php/php.ini
In php.ini, add these:
include_path = ".:/php/includes:/opt/app/php/lib/php"
date.timezone = 'America/Montreal'
Configure Apache
These lines are possibly already there since the PHP $(make install) takes care of it, if the httpd.conf file is "clean" (i.e. has not been modified from the originally installed file).
Add these to httpd.conf:
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php .phtml

Apache doesn't start on Snow Leopard using Terminal but works using Web Sharing (System Preferences)

I am using the default Apache installation that comes with Snow Leopard and I have some things installed like MySQL, Rudix (Unix ports and packages) and Xcode.
When I type:
$ sudo apachectl start
I receive this output:
dyld: Symbol not found: _apr_dir_open$INODE64
Referenced from: /usr/local/sbin/httpd
Expected in: /usr/local/lib/libapr-1.0.dylib
in /usr/local/sbin/httpd
/usr/local/sbin/apachectl: line 78: 2023 Trace/BPT trap $HTTPD -k $ARGV
I don't know if it's related but my .bash_profile has this line (I typed it because import MySQLdb was not working in Python):
export DYLD_LIBRARY_PATH="/usr/local/mysql/lib/:$DYLD_LIBRARY_PATH"
If I tick Web Sharing using System Preferences the Apache starts and work, but I wan't to start it using the terminal, maybe I am forgot to pass important arguments to the apachectl command.
The Web Sharing option of System Preferences enables the Apple-supplied Apache. Its apachectl is /usr/sbin/apachectl. You appear to have installed another version of Apache in /usr/local; note the /usr/local/sbin/apachectl path. So you are not using the Apple-supplied Apache installation when you are running from the terminal and the version you are using appears to not have been installed correctly. One way to ensure you are using the Apple-supplied Apache is to specify the full path:
$ sudo /usr/sbin/apachectl start