PHP setup for command line usage

PHP check

FolderShare command line client requires PHP, check if your system already has PHP7 installed (Recent versions of Mac OS already have PHP7.2+ installed).

# On terminal issue the following command
php -v

If PHP is not available use one of the following two methods to install php7 on your system

Building minimal PHP from source on linux

Download latest PHP7.x then unzip and build as follows 

# Fetch php7.2.22 source
curl -o php-7.2.22.tar.gz -L

# untar php source
tar xzf php-7.2.22.tar.gz

cd php-7.2.22

# Configure php for minimal build that we need for the FolderShare client
# Optionally add --prefix=/path/to/install
./configure --disable-all --disable-cgi --enable-cli --enable-filter --enable-json --enable-mbstring --with-curl --with-readline 

# build
# make install #if you added prefix

# Add environment path to find php
export PATH=`pwd`/sapi/cli:$PATH" #change this path if you added prefix

# Check if php is now in environment path
php -v

# Consider adding the php path in your shell profile (e.g. basic)

Install PHP with root privileges

apt-get install php7-cli php7-curl php7-mbstring php7-cli

Environment path

After installing PHP, add php to your environment path for e.g. append the following to your ~/.bashrc

export PATH="/full/path/to/php:$PATH"

Follow on to the next step to set up the FolderShare client.