Required steps to perform this:
You should have root access to terminal.
Server: Ubuntu 14
LAMP should be installed.
Run this command: cat /etc/motd.tail
- Open/Login SSH into the server
- Type in ps x
- See the list of processes currently on your server
- Get the PID(process id) from that list and type kill xxxxx
- That should do it.
Tested on Linux / CentOS 6.7 x 64
You can execute a php script in the background forever by using SSH through PHP but for that you have to make sure first that SSH2 extension is available.
$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_set_blocking($stream, true); $stream_out = ssh2_fetch_stream($stream, SSH2_STREAM_STDIO); echo stream_get_contents($stream_out); // closing ssh connection $stream = ssh2_exec($connection, 'exit'); unset($connection);
If you want to do same thing through SSH Terminal (PuTTY) then follow this tutorial:
SSH: how to run a PHP script in background forever in Linux (CentOS) ?
To execute a php file with different php version than the version installed on the main php of your Server follow this:
You should know that where is that php version located so that you can add the path.
In my case I want to use PHP 7 that is installed in the plesk hosting panel folder so I’ll run following command:
In above code server.php is the file which we want to execute. Just enter above command in the ssh terminal and it will execute successfully.
If your php is located in some other location then get that path and run in the same manner as I did above.
OS: CentOS 6.7 x 64
Download the autoinstaller from our website:
Add execute permissions to the autoinstaller:
chmod +x plesk-installer
Launch the autoinstaller:
If upgrading Plesk from a lower version:
GUI (Graphical user interface):
/usr/local/psa/admin/sbin/autoinstaller --all-versions --web-interface
For more information, please refer to Plesk Installation guide.
Tested on CentOS 6.7 x64