Run a PHP script with a specific Plesk PHP version
cron job with correct php version | run php script with different version | composer with plesk php | php | plesk | cronCaution: This command changes the system. Understand what it does before you run it.
/opt/plesk/php/8.3/bin/php /var/www/vhosts/example.com/httpdocs/cron.phpCalls the PHP interpreter of a specific Plesk PHP version directly via its full path. This way, cron jobs and maintenance scripts run with the same extensions and version as the website. Works the same for tools like Composer or WP-CLI, for example /opt/plesk/php/8.3/bin/php /usr/local/bin/composer install.
Note: The risk depends on the script. Run it as the subscription user, not as root.
Also searched as
- cron job with correct php version
- run php script with different version
- composer with plesk php