$connection = ssh2_connect('shell.example.com', 22);
ssh2_auth_password($connection, 'username', 'password');
/* if you want to execute script from a different directory then use commands in same line separated
by ';', that is required in php.
In below second command '&' will do the magic to run command forever.
$stream = ssh2_exec($connection, 'cd httpdocs/subdir/dir; /path/to/php server.php &');
$stream = ssh2_exec($connection, 'ps aux | grep server.php');
// printing ssh output on screen
$stream_out = ssh2_fetch_stream($stream, SSH2_STREAM_STDIO);
// closing ssh connection
$stream = ssh2_exec($connection, 'exit');
An alternative installation method uses the EPEL (Extra Packages for Enterprise Linux) repository that is available for CentOS and related distributions.
To gain access to the EPEL repo, you must modify the repo-list of your installation. Fortunately, we can reconfigure access to this repository by installing a package available in our current repos called epel-release.
sudo yum install epel-release
Now that you have access to the EPEL repository, you can install Node.js using your regular yum commands:
sudo yum install nodejs
Once again, you can check that the installation was successful by asking Node to return its version number: