Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to start with running a command line in PHP with CPanel hosting

I'm having a look at some PayPal scripts/code examples and a lot of them need a php script running via the command line.

I've never had to run anything from a command line in PHP before so don't know where to start at all. I don't know if I'm using the correct search terms as Google hasn't helped me answer.

Do I need to use a different application or is there something in cPanel I can use?

I get this error:

INSTALLATION ERROR: Please cd to the /home/site_name/public_html/site and run install.php
like image 901
penpen Avatar asked Apr 26 '12 18:04

penpen


People also ask

How do I run a command line in cPanel?

In cPanel & WHM version 72 and later, you can use cPanel's Terminal interface (cPanel >> Home >> Advanced >> Terminal) or WHM's Terminal interface (WHM >> Home >> Advanced >> Terminal) to access the command line from within the interface.

How do I run a PHP script from cPanel?

There's instructions on how to connect via PuTTY, then you can go to the directory where the PHP script is run it like: Show activity on this post. If your cPanel has the option to turn on SSH, do it. Then SSH into the server and run the commands -

How do I access my cPanel server from the command line?

To access your cPanel & WHM server from the command line, perform the following steps: Use the correct method for your computer’s operating system to open the CLI: Microsoft Windows® — Open the Command Prompt program. To do this, click Start and enter Command Prompt in the Search text box.

How do I change the default PHP language in cPanel?

Run the following command on the command line: # Set the “ea-php73” package as the default “PHP” programming language. In the above example, # Set the “ea-php73” package as the default indicates that the site uses the cPanel provided EasyApache PHP 7.3.

Is it possible to run PHP scripts via the command line?

When troubleshooting scripts, sometimes, it is necessary to run PHP scripts via the command-line. This information is also useful when configuring Cron Jobs.


1 Answers

Use SSH to access the server via the terminal:

http://docs.cpanel.net/twiki/bin/view/11_30/CpanelDocs/ShellAccess

There's instructions on how to connect via PuTTY, then you can go to the directory where the PHP script is run it like:

php myPHPScript.php

like image 172
Doug Molineux Avatar answered Nov 14 '22 22:11

Doug Molineux