# Customer SSH - Useful Commands

Enter a customer's application container To enter a website container as a customer, you can either:

Add your SSH key through "developer tools" in the UI when viewing the customer's website. SSH to username@server_ip as directed in the UI. Log in as root and type

su - customer_username

Either way you will be within the customer's containerised PHP environment and you will have access to exactly the same file structure and binaries that the customer's PHP applications will use. You can also see their PHP processes and any sub processes which might be forked.

Running PHP CLI:

The PHP binary is /usr/bin/php - this will be whatever version of PHP the customer has selected in their dashboard (under "developer tools").

php script.php

You will immediately see the output of the script. Many website scripts will behave in a similar way via CLI as they do on the web and this may help with debugging.

You can also run

strace php script.php

This will let you see the system calls which PHP is making - for instance if it's trying to read a particular file or connect to an IP address. This is also very useful for debugging.

Piping output

You may want to send the output of the script to a file. For example:

php script.php > script.log

Will send the output (stdout) to script.log

php script.php > script.log 2>&1

Will send both stdout and stderr to script.log.

/usr/bin/composer

This is PHP composer, a dependency manager for PHP. It may be required for installations of some scripts. Note that this requires appcd 1.1.0 and above.

/usr/bin/wp-cli

This is WP CLI, a suite of CLI commands for use with WordPress. You can install/update plugins, manage users and much more.

/usr/bin/top

This will show you the processes running inside the website's PHP container including how much CPU and memory they are using. A php-fpm or lsphp process using a high CPU percentage for a long time might have an infinite loop or contain malware.

/usr/bin/rm

Removes a file

/usr/bin/mkdir

Makes a new directory

/usr/bin/chmod

Changes file or directory permissions

*Copying files

You and your customers also have access to ssh and rsync binaries which are very useful for transferring websites from other servers without the risk of using root privileges.

Crontab

Please note, it is not possible to edit crontab from the customer's SSH environment at this time. Instead you need to use the control panel UI under "developer tools".