TurnKey Linux Virtual Appliance Library

Newbie Linux Help

rblackman'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

Perhaps you need to install php5-cli?

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

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

Glad you got it sorted! :)

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

Joomla, jDownloads auto publish solved.

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 www.jdownloads.com

Thanks for all your help.

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)