Home » Php » shell – Where to start with running a command line in PHP with CPanel hosting

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

Posted by: admin July 12, 2020 Leave a comment

Questions:

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
How to&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

Answer:

If your cPanel has the option to turn on SSH, do it. Then SSH into the server and run the commands –

cd /home/site_name/public_html/site
php install.php