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

2

8

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
Eldridgeeldritch answered 26/4, 2012 at 18:43 Comment(3)
I think there is a way to SSH into the server using cPanel: docs.cpanel.net/twiki/bin/view/11_30/CpanelDocs/ShellAccessLiquorish
otherwise, download chiark.greenend.org.uk/~sgtatham/putty/download.htmlArhat
My cPanel has that disabled so I have had to go through PuTTYEldridgeeldritch
L
3

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

Liquorish answered 26/4, 2012 at 18:47 Comment(6)
So I need to download "PuTTY" (from here chiark.greenend.org.uk/~sgtatham/putty/download.html) and then connect to my hosting and go from there?Eldridgeeldritch
Yes, that sounds about right, executing php from the command line is pretty simply, the hardest part will be configuring putty to actually logging in :)Liquorish
You were right, it's been a bit of an ordeal but thanks for getting me started! This little guide is quite handy for where to get started messing around with keys: support.hostgator.com/articles/specialized-help/technical/…Eldridgeeldritch
Thank you, there just doesn't seem to be any resources/tutorials for complete beginners who don't even know what the correct terms or programs to use are so you've been very helpful :)Eldridgeeldritch
The link is now broken :(Priester
Please either update link or remove it (it's broken)Rang
F
0

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
Flit answered 26/4, 2012 at 18:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.