Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I suspect your problem lies in a missing environment variable, specifically the all-important <code>$PATH</code>. When you run this:</p> <pre><code>php -q /tmp/phpinfo.php </code></pre> <p>the system must work out what program you mean by <code>php</code>. It does this by looking, in order, through the directories in the current <code>$PATH</code> environment variable. </p> <p>Executed from a normal shell, your environment is set up in such a way that it finds the CLI version of PHP, as you expect.</p> <p>However, when <code>cron</code> executes a command, it does so without all the environment variables that your interactive shell would set up. Since there will probably be other executables called <code>php</code> on your system, for different "SAPIs", it may pick the "wrong" one - in your case, the <code>cgi-fcgi</code> executable, according to the output you report from <code>php_sapi_name()</code>.</p> <p>To fix this, first find the path to the correct <code>php</code> executable in a normal shell by typing this:</p> <pre><code>which php </code></pre> <p>This should give you a path like <code>/usr/bin/php</code>. You can go one further and check if this is actually a "symbolic link" pointing at a different filename:</p> <pre><code>ls -l $(which php) </code></pre> <p>(you'll see an arrow in the output if it is, like <code>/usr/bin/php -&gt; /usr/bin/php5-cli</code>)</p> <p>Then take this full path to the PHP executable and use that in your crontab entry, so it looks something like this:</p> <pre><code>50 8 * * * /usr/bin/php5-cli -q /tmp/phpinfo.php &gt; /tmp/phpinfo </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload