KENNTNISSE · PHP-UMWELT
Wie man Cron Jobs einrichtet oder erzwingt, um eine PHP-Version zu verwenden
Zuletzt aktualisiert 2023-04-07
In all but our oldest servers, we have implemented a feature that allows you to set a version of PHP you want to use on your account. However, cron jobs running on a server will normally use the PHP version set for the server, and not the one specified by the PHP version tool. If your cron job needs to run with a different version of PHP, then you will need to specify it in your cron job command or script.
Der Befehlscode für den Beispiel-Cronjob wird unten angezeigt und wird mit der System-PHP-Version ausgeführt, die für den Server festgelegt wurde:
php -q /home/userna5/public_html/crondir/cronscript.php
Um den Beispiel-Cronjob mit einer bestimmten PHP-Versionszeile auszuführen, sagen Sie PHP Version 7.4 verfügbar durch "Auswählen einer PHP-Version" oder PHP Selector, ändern Sie den Befehl
/opt/alt/php74/usr/bin/php -q /home/userna5/public_html/crondir/cronscript.php
Um den Cron mit PHP 5.6 auszuführen, ersetzen Sie den 74 in /opt/alt/php74/usr/bin/php durch 56, um den Sample Cron als
/opt/alt/php56/usr/bin/php -q /home/userna5/public_html/crondir/cronscript.php
Sagen Sie uns, was aufbleiben muss.
A short conversation with an engineer. No quote-bot, no callback queue. We'll tell you honestly if we're not the right fit.