Image

Knowledge base → Executing a php script in the console for different php versions

[Virtual servers] [Shared hosting]
Date of publication: 08.10.2023

To check the operation of a php script, especially before adding it to the task scheduler, you need to check the operation in the console.

1. If version 1 of php is installed on the server, then the command will look like this

/usr/bin/php /var/www/vhosts/domain.tld/httpdocs/cron.php

2. In the case of virtual hosting for the Plesk control panel, for example for version php 7.4, use the command

/opt/plesk/php/7.4/bin/php /var/www/vhosts/domain.tld/httpdocs/cron.php

2.1 By analogy, you can also change the version and choose which php version the script will be executed from:

For php 8.2

/opt/plesk/php/8.2/bin/php /var/www/vhosts/domain.tld/httpdocs/cron.php

For php 8.1

/opt/plesk/php/8.1/bin/php /var/www/vhosts/domain.tld/httpdocs/cron.php

3. For a virtual server on Debian 12 in case of several versions of php, depending on the installed versions

/usr/bin/php7.3 /var/www/vhosts/domain.tld/httpdocs/cron.php

or

/usr/bin/php8.2 /var/www/vhosts/domain.tld/httpdocs/cron.php




No Comments Yet