![]() Log into your cPanel & create a new PHP file.To tar/untar a directory by executing SSH commands using a PHP file, follow the below steps: used wget command successfully in PHP script Tar/Untar files from cPanel using PHP script You’ll see the URL has been downloaded and uploaded directly inside your cPanel. Move back to the cPanel dashboard and navigate to your root directory. You’ll see a blank page once you hit the file from outside. wget Īs before, save the file and hit it from the outside. To use the wget command using PHP script, follow the above steps and change the command with the below command. But what if you don’t have SSH access enabled in your cPanel account? This script will help you in this situation. Let’s take one more example, what if you want to download a large file and upload it inside your cPanel? The best way to do it is via the wget command from SSH. This is how you can perform almost every SSH command from your cPanel itself. Save the file and again hit the file from outside.First, I’ll change the command by editing the test.php file. For example, now I want to list all contents present inside the document root (public_html). You can change the command inside your PHP script and refresh the page from the outside to see the changes.Now hit the file from outside, and you’ll be able to see the result of the df -h command which you’ve used in the above script.After pasting the above command hit the Save Changes button and then close the window.Once the editor window is opened, copy the below code and paste it there.Open the newly created PHP file by clicking over the Edit button. ![]() php extension, and hit the Create New File button. ![]() Navigate to your root directory (public_html) and create a new File.First of all, log into your cPanel account.How to Run Shell Commands Via PHP File in cPanel? So, if you don’t want to open your SSH terminal, and looking for an alternate method to run Shell commands from your cPanel itself. Sometimes, we all don’t want to do something without a reason. Yup, you can easily run and execute Shell/SSH commands in cPanel using a PHP script. No need to log into the SSH to execute the Shell commands. In this tutorial, we’re gonna walk you through the simple steps to run Shell Commands via PHP file in your cPanel account.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |