My Problem is that I cannot get my PHP Script to run from the command line. In this example I am trying to run Script allinone.php
I am relatively new to programming and have set up a Virtual Server. I have WHM, CPANEL . It is a Centos 6.5
I have saved my PHP Script in the CPANEL under home/higheryieldco/public_html/allinone.php
I can run the Script through the browser.
I can also (through the CRON CPANEL Icon) run this as a CRON job. The path is as below:-
/usr/bin/php -q/home/higheryieldco/public_html/allinone.php
I have gone into the command line for user higheryieldco through PUTTY.
When I type whereis PHP into the command line I get .....
PHP :/usr/bin/php /usr/lib/php.ini /usr/local/bin/php /usr/local/lib/php.ini etc
At the prompt have tried typing:-
php allinone.php
But all I get is .........Could not open input file : allinone.php
If I type the following:
#!/usr/bin/php
<?php echo"hello world"; ?>
I get................- bash : syntax error near unexpected token 'newline'
My aim is to run allinone.php from the command line but I can't make it work. Have I got the script saved in the wrong place for a command line activation? How and where would I save it?
Thanks for any help
I have been trying to follow this answer to no result: Where to start with running a command line in PHP with CPanel hosting