PHP exec() not working | php.ini is fine

You can change default PHP version in SSH terminal:

$ cp -f /usr/local/lsws/lsphp80/bin/php /usr/bin/

The default php.ini locations

/usr/local/lsws/lsphp80/etc/php.ini
/usr/local/lsws/lsphp74/etc/php.ini
/usr/local/lsws/lsphp73/etc/php.ini
/usr/local/lsws/lsphp72/etc/php.ini
/usr/local/lsws/lsphp71/etc/php.ini
/usr/local/lsws/lsphp70/etc/php.ini
/usr/local/lsws/lsphp56/etc/php.ini
/usr/local/lsws/lsphp55/etc/php.ini
/usr/local/lsws/lsphp54/etc/php.ini
/usr/local/lsws/lsphp53/etc/php.ini

You can run the script e.g.

$ /usr/local/lsws/lsphp80/bin/php shell_exec ("/my/script.py");

If its a permission issue follow this Shell_exec returns permissions error - #5 by chillyplate and see if it works for you

You can add a sink for the command e.g.

$ /usr/local/lsws/lsphp80/bin/php shell_exec("/home/mydomain.com/my_script.py 2>&1 | tee -a /home/mydomain.com/errorlog 2>/dev/null >/dev/null &");

OR better yet write a full script to run it e.g. php script would look like

<?php

$command = "run sth here";
shell_exec($command);

?>

place this somewhere in documentroot to run it