Richard Blackman's picture

I need to create a shell script to run a php program so I can run it via a cron job. I am running the Joomla 2.5 Turnkey install, which works great BTW. Apparently I need to know where php is installed to add a line of code in the shell script before the location and php filename? I type php at the root command prompt and nothing happens, I also read that one can run the command 'which php' but that gives an error.

Here's what I have so far but it just doesn't work, I don't think php is installed here...


/usr/bin/php /var/www/joomla/administrator/components/com_jdownloads/scan.php
I've spent all morning trying to figure this out, hopefully someone here can help.
Jeremy Davis's picture

To exexcute php from the commandline (and/or from a bash script/cron/etc) you need to have php5-cli installed. I don't recall if it is installed by default, but it's easy to install:

apt-get update && apt-get install php5-cli

And OTTOMH that should be the correct path for php. To double check try this:

whereis php
Richard Blackman's picture

Thanks for the help. Looks like php5-cli was not installed. After running that command you gave it installed and then I was able to run 'whereis php' and get a sensible answer. The path is correct.

Unfortunately, what I am trying to do with 'JPrc Cronjobs' (Joomla extension which is supposed to simulate running cron jobs within Joomla) still isn't working. I'll keep experimenting.

Richard Blackman's picture

I have it working now and I'm going to do a write up for others on the jdownloads support site. Which, by the way, is a great document management system for Joomla.

Thanks again for your help.

Jeremy Davis's picture

When you have it written up, feel free to post a link, because as you say others may well be interested

Richard Blackman's picture

To complete this thread my answer was found by using another Joomla extension. The program I was trying to get to autoupdate was jDownloads and the solution has now been put into the FAQ on their site at

Thanks for all your help.

Add new comment