Execute php file through shell command-line

I’m not too experienced with shell or what not, I only have experience with setting php script file to run in cpanel corn tabs/jobs. Is this similar? I have a script that downloads images (in data format), but it keeps timing out, it didn’t help when I increased maximum execution time. Anyway, I was told that I have to run the script through shell to bypass limitations and such. How would I go about doing this?

Basically I want it to run a php script file through shell command-line, I want to be able to set an interval when the file is run as well, same as what I’ll do when setting up a php script corn job.

You can use php-cli like:
> php script.php

or you can curl it like
> /usr/sbin/curl http://www.whatever.com

for cron you could do it either way.

The same script that you are calling from the browser you can call it from the shell.
For example if your script is in your home’s web root folder called get_images.php, the command would be:

/usr/bin/php -f /home/user/public_html/get_images.php

PHP’s path might be different on your system. This command can also be used for the cron job:

*/10 * * * * /usr/bin/php -f /home/user/public_html/get_images.php > /dev/null 2>&1